[Haskell-cafe] datatype contexts

Gregory Crosswhite gcross at phys.washington.edu
Mon Jul 26 10:48:43 EDT 2010

  I agree with prior discussion on this list that adding contexts to 
datatype declarations seems to be more trouble than its worth, since 
these contexts just have to be added again to every function using the 
datatype.  However, I have often wondered:  why do function *have* to 
have these contexts?  What would it affect in the language if we made 
the contexts be implicit, so that if we have

     data Datatype a = Context a => Datatype a

then for function declarations

     f :: D a -> ...

the context "Context a" is automatically asserted by the compiler?


More information about the Haskell-Cafe mailing list