How to fix DatatypeContexts?
harry
voldermort at hotmail.com
Thu Jul 18 14:35:36 CEST 2013
Sjoerd Visscher-2 wrote
> equal pair at Pair{} = foo pair == bar pair
Interesting solution, I didn't know you could do that. (Do all those who
suggested GADTs - you can add a type context to the constructor of a regular
data type as well, they don't bring you anything here.)
I've also been experiencing this a lot in class instances, such as:
class Foo f where
foo :: a -> f a
data Bar f a = Foo f => Bar {bar :: f a}
instance Foo (Bar f) where
foo a = Bar (foo a)
Is there any way to avoid repeating the Foo f constraint in the Bar f
instance?
--
View this message in context: http://haskell.1045720.n5.nabble.com/How-to-fix-DatatypeContexts-tp5733103p5733112.html
Sent from the Haskell - Glasgow-haskell-users mailing list archive at Nabble.com.
More information about the Glasgow-haskell-users
mailing list