[Haskell-cafe] Are constructors strict?
Sebastian Fischer
fischer at nii.ac.jp
Sat Jan 22 15:12:17 CET 2011
Hi Daryoush,
On Fri, Jan 21, 2011 at 7:52 PM, Daryoush Mehrtash <dmehrtash at gmail.com>wrote:
>
> loop = MonadPlus m => m Bool
>>
> loop = loop
>>
>
>> If we apply Just to loop as follows
>>
>
>> test2 :: MonadPlus m => m (Maybe Bool)
>>
> test2 = loop >>= return . Just
>>
>
>> the evaluation of test2 does not terminate because >>= has to evaluate
>> loop. But this does not correctly reflect the behaviour in a functional
>> logic language like Curry. For example, if you have a function that checks
>> whether the outermost constructor of test2 is Just, the test is supposed to
>> be successful. In the naive model for non-determinism this is not the case.
>>
>
> Do I have to have MonadPlus m or would any other Monad class work the same
> way?
>
I'm afraid, I don't quite get you question. Would you mind clarifying it
with an example?
Also, Jan, I don't understand your comment about continuation monads. Maybe
I am a bit numb today.. What property do you mean do continuation monads
have or not?
Thanks,
Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110122/672aa98c/attachment.htm>
More information about the Haskell-Cafe
mailing list