Re: [Haskell-cafe] Type classes and hFoldr from HList

2005-11-07 Thread Greg Buchholz
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

RE: [Haskell-cafe] Type classes and hFoldr from HList

2005-11-06 Thread Ralf Lammel
Hi Greg, Since hfoldr is right-associative, I prefer to reorder your list of functions as follows: test = HCons (length::String - Int) (HCons ((+1)::(Int-Int)) (HCons ((*2)::(Int-Int)) HNil)) Note that I also annotated length with its specific type. (If you really wanted to leave things more