Re: [Haskell-cafe] Are constructors strict?

2011-01-26 Thread Jan Christiansen
Hi, On 22.01.2011, at 08:12, Sebastian Fischer wrote: 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? I was wrong there. If there exist values x and y with x /= y and you

Re: [Haskell-cafe] Are constructors strict?

2011-01-25 Thread Daryoush Mehrtash
Sebastian, At high level, I understand the notion that thunks are about values and not nondeterminism computation but I have been missing the isight in the code as how this happens.. After reading it a few times and trying some experiments. This is my layman understanding of the problem... It

Re: [Haskell-cafe] Are constructors strict?

2011-01-22 Thread Sebastian Fischer
Hi Daryoush, On Fri, Jan 21, 2011 at 7:52 PM, Daryoush Mehrtash dmehrt...@gmail.comwrote: 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

Re: [Haskell-cafe] Are constructors strict?

2011-01-21 Thread Jan Christiansen
On 20.01.2011, at 22:18, Daryoush Mehrtash wrote: I am having hard time understanding the following paragraph in Purely functional Lazy non-deterministic programing paper http://www.cs.rutgers.edu/~ccshan/rational/lazy-nondet.pdf The problem with the naive monadic encoding of

Re: [Haskell-cafe] Are constructors strict?

2011-01-21 Thread Sebastian Fischer
sorry, forgot to cc cafe. On Fri, Jan 21, 2011 at 7:12 PM, Sebastian Fischer fisc...@nii.ac.jpwrote: Hi Daryoush, On Fri, Jan 21, 2011 at 6:18 AM, Daryoush Mehrtash dmehrt...@gmail.comwrote: I am having hard time understanding the following paragraph in Purely functional Lazy

Re: [Haskell-cafe] Are constructors strict?

2011-01-21 Thread Daryoush Mehrtash
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

Re: [Haskell-cafe] Are constructors strict?

2011-01-21 Thread Jan Christiansen
On 21.01.2011, at 11:52, Daryoush Mehrtash wrote: Do I have to have MonadPlus m or would any other Monad class work the same way? Not all monad instances satisfy undefined = return . Just = undefined if that's what you are asking for. For example, consider the identity monad.

[Haskell-cafe] Are constructors strict?

2011-01-20 Thread Daryoush Mehrtash
I am having hard time understanding the following paragraph in Purely functional Lazy non-deterministic programing paper http://www.cs.rutgers.edu/~ccshan/rational/lazy-nondet.pdf The problem with the naive monadic encoding of non-determinism is that the arguments to a constructor must be

Re: [Haskell-cafe] Are constructors strict?

2011-01-20 Thread Edward Z. Yang
Hello Daryoush, That is a good question, and depends on distinguishing between laziness and nondeterminism. Suppose I have a normal, lazily evaluated list: [1,2...] There are thunks used in this case, but the end result is fully deterministic: the next will always be 3, and then 4, and so