Now I'm trying if it's possible to implement the series in a single shot [3] .forLiftZ1 :: Zip f => f a -> (a -> b) -> f bforLiftZ2 :: Zip f => f a -> f b -> (a -> b -> c) -> f c
forLiftZ3 :: Zip f => f a -> f b -> f c -> (a -> b -> c -> d) -> f d
_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
forLiftZ1 :: Zip f => f a -> (a -> b) -> f b forLiftZ2 :: Zip f => f a -> f b -> (a -> b -> c) -> f c forLiftZ3 :: Zip f => f a -> f b -> f c -> (a -> b -> c -> d) -> f
d
...and more...
https://github.com/nushio3/practice/blob/master/free-objects/zipf-12.hs
I was finally able to remove the verbose type annotations.
The point was (1) to let the argument-list carry the type-constructor
information, so that only values of the type (v a) can enter the
heterogeneous list;
data Cons (v :: * -> *) a b = Cons a b deriving (Eq, Show)
data Nil (v :: * -> *) = Nil deriving (Eq, Show)
(2) to change the remainder of the program accordingly, and (3) to add
the following subtle modification, because instance finder does not
attempt to match unknown type a0 to "v result", but it does so to
"result."
class Reduce v f vxS result vyS | v f vxS -> result vyS where
reduce :: v f -> vxS -> (v result, vyS)
↓
class Reduce v f vxS result vyS | v f vxS -> result vyS where
reduce :: v f -> vxS -> (result, vyS)
Other samples work with modest type annotations.
https://github.com/nushio3/practice/blob/master/free-objects/zipf-13.hs
2012/12/1 Takayuki Muranushi <mura...@gmail.com>