Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Seq question (Henk-Jan van Tuyl)


----------------------------------------------------------------------

Message: 1
Date: Thu, 19 Apr 2012 11:31:13 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] Seq question
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
        delsp=yes

On Wed, 18 Apr 2012 16:45:05 +0200, Brent Yorgey <[email protected]>  
wrote:

> On Tue, Apr 17, 2012 at 02:41:15PM -0700, Tim Perry wrote:
>> seq evaluates to Weak Head Normal Form (WHNF). WHNF is the first
>> contructor. So your use of seq only evaluates the first number and the
>> cons. I.E., it evaluates to:
>> s:(Thunk)
>
> Actually, it doesn't even force the first number.  You just get
>
> Thunk : Thunk
>

A nice way to demonstrate this, is the following GHCi session:
   Prelude> undefined `seq` print "OK"
   *** Exception: Prelude.undefined
   Prelude> [undefined] `seq` print "OK"
   "OK"


Regards,
Henk-Jan van Tuyl


-- 
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--



------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 46, Issue 33
*****************************************

Reply via email to