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: Example needed (Yitzchak Gale)
2. Re: How does the Deriving being implemented in Haskell?
(Jonas Almstr?m Dureg?rd)
3. Haskell User Group in Stockholm (Obscaenvs)
----------------------------------------------------------------------
Message: 1
Date: Wed, 15 Jun 2011 09:29:41 +0300
From: Yitzchak Gale <[email protected]>
Subject: Re: [Haskell-beginners] Example needed
To: Zhi-Qiang Lei <[email protected]>
Cc: Haskell Beginer <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Zhi-Qiang Lei wrote:
> I wonder why haskell do not take foldl' as default foldl if foldl is not used
> in production often.
In the Haskell standard, which is not tied to any particular compiler,
foldl is defined in the simplest way. The problem of stack overflows is
left to be solved by each compiler.
And in fact, with optimization turned on, GHC does figure out the right
thing to do in many of the common cases.
That is the history and the logic; but I agree with you that it would have
made more sense for what we call foldl' to have been the default.
> Can you give me a example about how foldl can work on an infinite list?
Prelude Data.List> foldl (const last) 0 [[3..], [7,8,9]]
9
Prelude Data.List> foldl' (const last) 0 [[3..], [7,8,9]]
<hangs until you interrupt with ^C>
Regards,
Yitz
------------------------------
Message: 2
Date: Wed, 15 Jun 2011 09:00:30 +0200
From: Jonas Almstr?m Dureg?rd <[email protected]>
Subject: Re: [Haskell-beginners] How does the Deriving being
implemented in Haskell?
To: Haisheng Wu <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Not sure exactly what you want to know, but in the language report it
says "For an enumeration, the first and last constructors listed in
the data declaration are the bounds".
http://www.haskell.org/onlinereport/haskell2010/haskellch11.html#x18-18500011.3
On 14 June 2011 14:07, Haisheng Wu <[email protected]> wrote:
> Hi guys,
> ? What I understanding `deriving` is Haskell automatically make a type to be
> a instance of a particular typeclass.
> ? If that's the case, the question is How does Haskell do that underline?
>
> ? Take code below as sample, the type Day is now an instance of Bounded.
>
> ?data Day = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday |
> Sunday
> ??????????? deriving (Bounded, Enum)
>
> ? Therefore, minBound :: Day will produce Monday.
>
> ?Just be curious how it is being implemented.
>
> Thanks.
> Simon
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
------------------------------
Message: 3
Date: Wed, 15 Jun 2011 09:27:23 +0200
From: Obscaenvs <[email protected]>
Subject: [Haskell-beginners] Haskell User Group in Stockholm
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
OK, this *might* be slightly off-topic, but I couldn't find a more
suiting list to post to:
Any body here living in Stockholm interested in starting a user group?
/Fredrik, old-as-hell graduate mathematics student
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 36, Issue 38
*****************************************