[Haskell-cafe] Polymorphic algebraic type constructors
MR K P SCHUPKE
k.schupke at imperial.ac.uk
Tue Jun 22 08:29:02 EDT 2004
>data E a b
> = L1 { r :: a }
> | L2 { r :: a }
> | L3 { r :: a }
> | L4 { r :: a }
> | R b
> deriving Show
How is this different from:
data E a b = L1 a | L2 a | R b
f g (R a) = R (g a)
f _ other = other
Isn't this more or less what was in the original...
The problem is the type:
f :: (a->b) -> Either String a -> Either String b
this line: f _ other = other
says: Either String a == Either String b -- which it doesn't
Keean.
More information about the Haskell-Cafe
mailing list