[Haskell-cafe] Confused by SYB example with zipping
Henry Laxen
nadine.and.henry at pobox.com
Sat Feb 14 15:55:20 EST 2009
Dear Group,
When trying to run the example at:
http://www.cs.vu.nl/boilerplate/testsuite/gzip/Main.hs
ghc 6.10.1 says
A pattern type signature cannot bind scoped type variables `a'
unless the pattern has a rigid type context
In the pattern: f :: a -> a -> a
In the definition of `mkTT':
mkTT (f :: a -> a -> a) x y
= case (cast x, cast y) of {
(Just (x' :: a), Just (y' :: a)) -> cast (f x' y')
_ -> Nothing }
In the definition of `main':
main = print $ gzip (mkTT maxS) genCom1 genCom2
where
genCom1 = everywhere (mkT (double "Joost")) genCom
genCom2 = everywhere (mkT (double "Marlow")) genCom
double x (E (p@(P y _)) (S s)) | x == y = E p (S (2 * s))
double _ e = e
maxS (S x) (S y) = S (max x y)
....
Failed, modules loaded: CompanyDatatypes.
---------------------------------------------------------------------
I must admit I don't really know what to make of this. Any insights would
be appreciated.
Thanks.
Henry Laxen
More information about the Haskell-Cafe
mailing list