[Haskell-cafe] Re: Why is type 'b' forced to be type 'm a' and not
possibly 'm a -> m a'
tpledger at ihug.co.nz
tpledger at ihug.co.nz
Sun Oct 1 05:44:31 EDT 2006
Vivian McPhail wrote:
...
> I need the arg a to be evaluated before it gets
> passed to a1 and a2. This definition does the right thing
> when type 'a' is a function type, because it is not a
> value, but with something like 'm a -> (m a -> m a) -> m
> a' with Forkable (a -> b) the first arg gets evaluated
> twice, to be more concrete:
>
> With
>
> (and golden white) eggs
>
> I want the 'eggs' that is passed to 'golden' to be the
> same as the 'eggs' that is passed to 'white', i.e.
...
Could you reduce the need for Forkable instances, by
rewriting '(and golden white) eggs' as 'and golden white =<<
eggs'? Or would the same piece of code also have to handle
combinations such as monadic 'and golden white' and
non-monadic eggs?
[BTW, thanks for giving me a pretext to use the phrase
non-monadic eggs!]
> Tom suggested that I might be able to use the Reader monad
> , but I'm not clear as to how I could do this.
Please ignore that. I only mentioned it in case the sole
purpose of fork was to propagate a String, which you've now
explained is not so.
Regards,
Tom
More information about the Haskell-Cafe
mailing list