Hi All,
I'm trying to write a generic curry ( uncurry) function that works for
functions of any arity. I have a couple solutions that nearly work, both
involving type classes.
Here's the first one:
class Curry tupled curried where
genericCurry :: tupled - curried
genericUncurry :: curried
Duncan Coutts [EMAIL PROTECTED] writes:
So I thought that functional dependencies might help because the curried
type should uniquely determine the uncurried type (and vice versa).
However if I change the class declaration to:
class Curry tupled curried | tupled - curried, curried - tupled
In message [EMAIL PROTECTED], Duncan Coutts writes:
I'm trying to write a generic curry ( uncurry) function that works for
functions of any arity. I have a couple solutions that nearly work, both
involving type classes.
[SNIP]
Any insight or suggestions would be interesting.
Here's one solution,
Hello,
I needed to compose monadic functions, since I couldn't find anything in
Control.Monad so I defined my own. I first came up with a left associative
version:
compLM [f1,..., fn] a = (f1 a = f2) = ... = fn
compLM:: Monad m = [a-m a] - (a-m a)
compLM mfs a = foldl (=) (return a)