How to fix DatatypeContexts?

Christopher Done chrisdone at gmail.com
Thu Jul 18 13:05:40 CEST 2013


Hm, also, with equality constraints you can make the type parametrized, too:

data Pair a' = forall a. (a ~ a', Eq a) => Pair {x::a, y::a}
equal :: Pair a -> Bool
equal (Pair x y) = x == y


On 18 July 2013 13:00, Christopher Done <chrisdone at gmail.com> wrote:

> Why not this?
>
> data Pair = forall a. Eq a => Pair {x::a, y::a}
> equal :: Pair -> Bool
> equal (Pair x y) = x == y
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20130718/aed34f4e/attachment.htm>


More information about the Glasgow-haskell-users mailing list