Re: [Haskell-cafe] Accepting and returning polyvariadic functions

2010-08-12 Thread Will Jones
Hi Tillmann, That's worked a treat -- thanks ever so much :) Will On Wed, Aug 11, 2010 at 7:50 PM, Tillmann Rendel ren...@mathematik.uni-marburg.de wrote: Will Jones wrote: f :: Int - IO () f = undefined g :: Int - Int - IO () g = undefined h :: Int - Int - Int - IO () h

Re: [Haskell-cafe] Accepting and returning polyvariadic functions

2010-08-11 Thread Ryan Ingram
There's no (safe) way to go from a - IO b to IO (a - b) which is part of what vtuple does. Consider foo :: Int - IO String foo 0 = return zero foo _ = launchMissles return fired! How would you implement foo2 :: IO (Int - String) with the same behavior? You can't; you would somehow need to

Re: [Haskell-cafe] Accepting and returning polyvariadic functions

2010-08-11 Thread Will Jones
Hi Ryan, Thanks for the reply. The specification I've given is just to illustrate the kind of relationship I'm trying to establish between the types of the argument and the result. In reality the type of the argument function is something a little more usable; you could generalise it with type

Re: [Haskell-cafe] Accepting and returning polyvariadic functions

2010-08-11 Thread Bartek Ćwikłowski
Hello Will, 2010/8/11 Will Jones w...@sacharissa.co.uk: I'm trying to write a function (I'll call it `vtuple' for lack of a better name) that returns a function that itself returns multiple arguments in the form of a tuple. For example: vtuple f :: IO (Int - (Int, ())) vtuple g :: IO (Int

Re: [Haskell-cafe] Accepting and returning polyvariadic functions

2010-08-11 Thread Tillmann Rendel
Will Jones wrote: f :: Int - IO () f = undefined g :: Int - Int - IO () g = undefined h :: Int - Int - Int - IO () h = undefined vtuple f :: IO (Int - (Int, ())) vtuple g :: IO (Int - Int - (Int, (Int, ( I've tried to type vtuple using a type class; [...] I've thought about