[Haskell-beginners] Data.Stream interleave implementation question
Kim-Ee Yeoh
ky3 at atamo.com
Wed Feb 12 09:11:08 UTC 2014
On Wed, Feb 12, 2014 at 11:23 AM, Bryan Brady <bryan.brady at gmail.com> wrote:
> In the latter definition, Cons a (interleaveStreams bs as),
> (interleaveStreams bs as) is a thunk. The thunk should only be evaluated
> when it is needed. In my original definition, (interleaveStreams as bs) is
> a thunk. The difference is an extra Cons (e.g., Cons b). It seems like the
> additional Cons is causing problems, I just don't understand why. Can
> anyone point out what I'm missing?
As Isaac wrote, you want to look at the _left_ hand side, not the right.
It's pattern matching that impacts operational semantics.
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140212/05db6d5f/attachment.html>
More information about the Beginners
mailing list