Re: [Haskell-cafe] (a -> [b]) vs. [a -> b]

2007-02-02 Thread J. Garrett Morris
Uh, apologies. I got confused between reading your post and playing for a while, and answered the wrong question. /g On 2/2/07, J. Garrett Morris <[EMAIL PROTECTED]> wrote: On 2/2/07, Chad Scherrer <[EMAIL PROTECTED]> wrote: > So in reality, I'm trying to construct something like > f :: (a ->

Re: [Haskell-cafe] (a -> [b]) vs. [a -> b]

2007-02-02 Thread J. Garrett Morris
On 2/2/07, Chad Scherrer <[EMAIL PROTECTED]> wrote: So in reality, I'm trying to construct something like f :: (a -> STM b) -> STM (a -> b) I just figured it was a general monadic kind of problem, more simply expressed using lists. But the (!!) solution doesn't make sense in this context. Perh

Re: [Haskell-cafe] (a -> [b]) vs. [a -> b]

2007-02-02 Thread Chad Scherrer
Oops, I thought I had sent a response to the cafe, but it looks like it just went to Matthew. Unfortunately, I was trying to give a simplification of the real problem, where the monad is STM instead of []. Based on apfelmus's observation of why they can't be isomorphic, I'm guessing I'm out of lu

Re: [Haskell-cafe] (a -> [b]) vs. [a -> b]

2007-02-02 Thread Yitzchak Gale
Chad Scherrer wrote: Are (a -> [b]) and [a -> b] isomorphic? I'm trying to construct a function f :: (a -> [b]) -> [a -> b] that is the (at least one-sided) inverse of f' :: [a -> b] -> a -> [b] f' gs x = map ($ x) gs Anything better than this? f g = [\x -> g x !! n | n <- [0..]] -Yitz ___

Re: [Haskell-cafe] (a -> [b]) vs. [a -> b]

2007-02-01 Thread Matthew Brecknell
Chad Scherrer said: > Are (a -> [b]) and [a -> b] isomorphic? > > I'm trying to construct a function > > f :: (a -> [b]) -> [a -> b] > > that is the (at least one-sided) inverse of > > f' :: [a -> b] -> a -> [b] > f' gs x = map ($ x) gs > > It seems like it should be obvious, but I haven't had

[Haskell-cafe] (a -> [b]) vs. [a -> b]

2007-02-01 Thread Chad Scherrer
Are (a -> [b]) and [a -> b] isomorphic? I'm trying to construct a function f :: (a -> [b]) -> [a -> b] that is the (at least one-sided) inverse of f' :: [a -> b] -> a -> [b] f' gs x = map ($ x) gs It seems like it should be obvious, but I haven't had any luck with it yet. Any help is greatly a