[Haskell-cafe] pattern match on forall'ed data
corentin.dupont at gmail.com
Wed Jul 20 15:18:26 UTC 2016
I'm surprised this doesn't work:
data SomeData = forall e. (Typeable e, Eq e) => SomeData e
(===) :: (Typeable a, Typeable b, Eq a, Eq b) => a -> b -> Bool
(===) x y = cast x == Just y
test :: SomeData' -> Bool
test (SomeData' e) | e === Nothing = True
test _ = False
Could not deduce (Eq a1) arising from a use of ‘===’
How can I achieve something of the same effect?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe