[Haskell] generic currying (type classes and functional dependencies)

2004-05-11 Thread Duncan Coutts
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

Re: [Haskell] generic currying (type classes and functional dependencies)

2004-05-11 Thread Malcolm Wallace
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

Re: [Haskell] generic currying (type classes and functional dependencies)

2004-05-11 Thread Esa Pulkkinen
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,

[Haskell-cafe] Monadic Composition

2004-05-11 Thread Jorge Adriano Aires
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)