[Haskell] Type Lambdas in Gofer

Jim Apple jbapple+haskell at gmail.com
Tue Jul 31 23:58:27 EDT 2007

The code in "Bananas in Space: Extending Fold and Unfold to Exponential Types"


uses Gofer, and has examples such as

data Rec f = In (f (Rec f))
type P f a = f (Rec f, a)

mapP :: Functor f => (a -> b) -> P f a -> P f b
mapP g = fmap (\(x,a) -> (x, g a))

instance Functor f => Functor (P f) where
    fmap = mapP

Why did Gofer have this power while Haskell does not?


More information about the Haskell mailing list