[Haskell-cafe] Constructor question

michael rice nowgate at yahoo.com
Sat Jul 31 10:22:16 EDT 2010


This Joni Mitchell lyric just popped into my head:

"I've looked at clouds from both sides now
>From up and down, and still somehow
It's cloud illusions I recall
I really don't know clouds at all"

A LOT of cool stuff here, but the learning curve is murder.

Michael



--- On Sat, 7/31/10, Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> wrote:

From: Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com>
Subject: Re: [Haskell-cafe] Constructor question
To: "michael rice" <nowgate at yahoo.com>
Cc: haskell-cafe at haskell.org
Date: Saturday, July 31, 2010, 9:32 AM

michael rice <nowgate at yahoo.com> writes:

> From: Data.Complex
>
> data (RealFloat a) => Complex a
>   = !a :+ !a
>
> What's the purpose of the exclamation marks?

Forcing; it means that the values are evaluated (up to WHNF) before the
Complex value is constructed:

http://www.haskell.org/ghc/docs/6.12.1/html/users_guide/bang-patterns.html

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100731/d504813c/attachment.html


More information about the Haskell-Cafe mailing list