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 ->
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
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
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
___
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
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