[Haskell-cafe] Type classes and hFoldr from HList

Greg Buchholz haskell at sleepingsquirrel.org
Mon Nov 7 15:50:00 EST 2005


Ralf Lammel wrote:
> 
> What you can do is define a dedicated *type code* for composition.
> 
> comp  = hFoldr (undefined::Comp) (id::Int -> Int) test
> 
> data Comp
> 
> instance Apply Comp (x -> y,y -> z) (x -> z)
>  where
>   apply _ (f,g) = g . f

    That does it!


Thanks,
    
Greg Buchholz


More information about the Haskell-Cafe mailing list