[Haskell-beginners] How to avoid repeating a type restriction from a data constructor

gs voldermort at hotmail.com
Wed Apr 24 20:39:15 CEST 2013


Daniel Fischer <daniel.is.fischer <at> googlemail.com> writes:
 
> The point is that the type class dictionary is required to use the class 
> methods, and with a GADT, the dictionary is bundled with the constructor, so 
> pattern-matching makes the dictionary available.
> 
> Not so with DatatypeContexts, hence the dictionary must be explicitly passed 
> with the context on the function.

So is this more of an implementation issue? No "real" ill-typed programs
will get through the type checker if the compiler could remember the type
dictionary without pattern-matching or explicit context?




More information about the Beginners mailing list