[Haskell-cafe] EduHaskell

Johannes Waldmann johannes.waldmann at htwk-leipzig.de
Sun Sep 24 15:05:03 UTC 2017


Dear Martin,


I use Haskell for teaching as well (not for beginners) [1].
I do use ghci in lab classes. For the problems you mention,
I have these sort-of work-arounds:


> Errors resulting from overloading

numerical literals, arithmetical operators?
avoid built-in (Prelude) numbers and the Num class.

stuff that's been generalized from list to Foldable (e.g., length)?
avoid built-in (Prelude) lists [2]


> Errors due to undefined type class instances
> (specifically, Eq and Show)

I think these classes are somewhat easy to motivate -
at least Eq is (we need "==" to notate and test properties of programs,
not every type has decidable equality (functions have not),
so we need to mark the types that do)
For Show, it's not that nice (ghci uses "show" but implicitly -
then why do we need to write the Show instance explicitly)
Still, adding "deriving (Eq, Show)" after each data declaration
is not too much of a burden. I agree it is a distraction.


> Errors in the context of parametric polymorphism

Well, it's an important concept to teach,
so it is natural that it takes some time and work.

(slightly tangential - I think it would already help
if it would be easier to declare types of identifiers -
to remove unwanted polymorphism.
E.g., "\ (x::Bool) (y::Bool) -> x || y" currently requires
a language pragma (!) whose name mentions type variables (!!) )


- Johannes.


[1] https://www.imn.htwk-leipzig.de/~waldmann/talk/17/wflp
[2]
https://www.imn.htwk-leipzig.de/~waldmann/etc/untutorial/list-or-not-list/


More information about the Haskell-Cafe mailing list