Function Composition in Haskell

Posted by Watts on Stack Overflow See other posts from Stack Overflow or by Watts
Published on 2012-12-05T03:58:59Z Indexed on 2012/12/05 5:04 UTC
Read the original article Hit count: 118

Filed under:

I have a function that takes 3 functions and switches the types and combine to make a new function.

For example a test case call would be : (chain init tail reverse ) "Haskell!" the output should be lleksa

I've tried to do this problem a few different ways including using the map function but I kept getting association problems. so i did

chain :: Ord a => [a] -> a
chain f g h x = f.g.h$x

my error is Couldn't match expected type[t0->t1->t2->a0]

When I type the problem directly into prelude like replacing f, g, h, x with the values it comes out right

Is there even a way to do three functions, I've only seen two in examples

© Stack Overflow or respective owner

Related posts about haskell