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. Urgent help required, life threatening... (Sean Charles)
2. Re: Urgent help required, life threatening... (Christopher Done)
3. Re: Urgent help required, life threatening... (Sean Charles)
4. Re: Urgent help required, life threatening... (Joseph Fredette)
5. Re: Urgent help required, life threatening... (Sean Charles)
6. Problem with space leak in GHC compiled code using fix
(Will Ness)
7. Re: a problem with maps (Brent Yorgey)
8. Re: a problem with maps (Brent Yorgey)
----------------------------------------------------------------------
Message: 1
Date: Mon, 25 Jul 2011 12:13:02 +0100
From: Sean Charles <[email protected]>
Subject: [Haskell-beginners] Urgent help required, life threatening...
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Does anybody know any way at all that I can de-program my mind to go
back to working with OO, specifically PHP, ever again?
I've seen the Haskell light and it is good and pure and PHP is brown,
dirty and slimy. Please boss, don't make me code more communications
protocols in PHP, please.
Please help.
------------------------------
Message: 2
Date: Mon, 25 Jul 2011 13:45:19 +0200
From: Christopher Done <[email protected]>
Subject: Re: [Haskell-beginners] Urgent help required, life
threatening...
To: Sean Charles <[email protected]>
Cc: [email protected]
Message-ID:
<CAAJHNPBBK54oFCRS_BkGw0nUAMFCSe1shZa9n=1fejeeekw...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
On 25 July 2011 13:13, Sean Charles <[email protected]> wrote:
> I've seen the Haskell light and it is good and pure and PHP is brown, dirty
> and slimy. Please boss, don't make me code more communications protocols in
> PHP, please.
The first step is accepting that you have an addiction (to Haskell).
You're making excellent progress.
On 25 July 2011 13:13, Sean Charles <[email protected]> wrote:
> Does anybody know any way at all that I can de-program my mind to go back to
> working with OO, specifically PHP, ever again?
Consider it an exercise in cognitive dissonance.
------------------------------
Message: 3
Date: Mon, 25 Jul 2011 12:56:33 +0100
From: Sean Charles <[email protected]>
Subject: Re: [Haskell-beginners] Urgent help required, life
threatening...
To: [email protected]
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
> The first step is accepting that you have an addiction (to Haskell).
>
> You're making excellent progress.
Thanks. I am trying to draft a 12-step program to get me back down.
Hi, my name is <your-name> and I am an Haskel-holic. It's been
<time-period-here> since my last functional programming session...
> On 25 July 2011 13:13, Sean Charles<[email protected]> wrote:
>> Does anybody know any way at all that I can de-program my mind to go back to
>> working with OO, specifically PHP, ever again?
> Consider it an exercise in cognitive dissonance.
That's a fascinating subject and particularly relevant: I am
're-writing' some code at the moment to 'comply' (you have ten seconds
to put down your weapon) with local coding standards regarding variable
naming for PHP code and hating every second of it. I mean, what's point
of that for PHP (no language war intended). I am trying to introduce
Erlang here, gently!
Have a good day everybody.
:)
Sean
PS: Don't press the red button.
------------------------------
Message: 4
Date: Mon, 25 Jul 2011 08:28:27 -0400
From: Joseph Fredette <[email protected]>
Subject: Re: [Haskell-beginners] Urgent help required, life
threatening...
To: Sean Charles <[email protected]>
Cc: [email protected]
Message-ID:
<camzje54v1tcctjua+pubyheycugkenqhkdnfq10b6kyj0va...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
The issue is, I should think, not the necessity of using OO-style, but the
necessity of using PHP to do it.
On Mon, Jul 25, 2011 at 7:56 AM, Sean Charles <[email protected]> wrote:
>
> The first step is accepting that you have an addiction (to Haskell).
>>
>> You're making excellent progress.
>>
> Thanks. I am trying to draft a 12-step program to get me back down.
> Hi, my name is <your-name> and I am an Haskel-holic. It's been
> <time-period-here> since my last functional programming session...
>
>
> On 25 July 2011 13:13, Sean Charles<[email protected]> wrote:
>>
>>> Does anybody know any way at all that I can de-program my mind to go back
>>> to
>>> working with OO, specifically PHP, ever again?
>>>
>> Consider it an exercise in cognitive dissonance.
>>
> That's a fascinating subject and particularly relevant: I am 're-writing'
> some code at the moment to 'comply' (you have ten seconds to put down your
> weapon) with local coding standards regarding variable naming for PHP code
> and hating every second of it. I mean, what's point of that for PHP (no
> language war intended). I am trying to introduce Erlang here, gently!
>
> Have a good day everybody.
> :)
> Sean
>
> PS: Don't press the red button.
>
>
>
> ______________________________**_________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/**mailman/listinfo/beginners<http://www.haskell.org/mailman/listinfo/beginners>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110725/1b1f3035/attachment-0001.htm>
------------------------------
Message: 5
Date: Mon, 25 Jul 2011 14:26:54 +0100
From: Sean Charles <[email protected]>
Subject: Re: [Haskell-beginners] Urgent help required, life
threatening...
To: Joseph Fredette <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
On 25/07/11 13:28, Joseph Fredette wrote:
The issue is, I should think, not the necessity of using OO-style, but
the necessity of using PHP to do it.
O.O. => openly obfuscated
>
> On Mon, Jul 25, 2011 at 7:56 AM, Sean Charles <[email protected]
> <mailto:[email protected]>> wrote:
>
>
> The first step is accepting that you have an addiction (to
> Haskell).
>
> You're making excellent progress.
>
> Thanks. I am trying to draft a 12-step program to get me back down.
> Hi, my name is <your-name> and I am an Haskel-holic. It's been
> <time-period-here> since my last functional programming session...
>
>
> On 25 July 2011 13:13, Sean Charles<[email protected]
> <mailto:[email protected]>> wrote:
>
> Does anybody know any way at all that I can de-program my
> mind to go back to
> working with OO, specifically PHP, ever again?
>
> Consider it an exercise in cognitive dissonance.
>
> That's a fascinating subject and particularly relevant: I am
> 're-writing' some code at the moment to 'comply' (you have ten
> seconds to put down your weapon) with local coding standards
> regarding variable naming for PHP code and hating every second of
> it. I mean, what's point of that for PHP (no language war
> intended). I am trying to introduce Erlang here, gently!
>
> Have a good day everybody.
> :)
> Sean
>
> PS: Don't press the red button.
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected] <mailto:[email protected]>
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110725/49ea7575/attachment-0001.htm>
------------------------------
Message: 6
Date: Mon, 25 Jul 2011 13:49:27 +0000 (UTC)
From: Will Ness <[email protected]>
Subject: [Haskell-beginners] Problem with space leak in GHC compiled
code using fix
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Hi, could someone please help me understand this, thanks.
In reformulation of a code with no space leak, the leak reappeares.
It takes near constant space to get at the n-th elt in the produced list here
(http://ideone.com/wxmR5):
{-# OPTIONS_GHC -O2 -fno-cse #-}
primes = 2 : ([3,5..] `minus`
foldi (\(x:xs) -> (x:) . union xs)
[[x*x, x*x+2*x..] | x<- ys])
where
ys = 3 : ([5,7..] `minus`
foldi (\(x:xs) -> (x:) . union xs)
[[x*x, x*x+2*x..] | x<- ys])
foldi f (x:xs) = f x (foldi f (pairs f xs))
pairs f (x:y:t) = f x y : pairs f t
Here the memory usage grows linearly at least (https://ideone.com/qpnqe):
{-# OPTIONS_GHC -O2 #-}
primes = 2 : g (fix g)
where
g = (3:) . ([5,7..] `minus`)
. foldi (\(x:xs) -> (x:) . union xs)
. map (\x-> [x*x, x*x+2*x..])
I expected the 2nd to be equivalent to the 1st. This also impacts its
performance: the 2nd code runs at empirical complexity of O(n^1.24) instead of
O(n^1.20) of the 1st one (in ''n'' primes produced).
In Hugs (Nov 2002) the reported stats and run times are very similar for the
both versions.
Is this a GHC thing, or a language thing? Can anything be done to have the
shorter 2nd variant without a space leak?
Thanks,
------------------------------
Message: 7
Date: Mon, 25 Jul 2011 12:20:26 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] a problem with maps
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Sat, Jul 23, 2011 at 08:44:56AM -0400, David Place wrote:
>
> If I am reading your code, I may look up second and find it in
> Control.Arrow. I have to learn about Arrows to understand your
> code? And pure makes me need to study the Applicative class. I
> imagine that it is likely that second is the only thing from
> Control.Arrow that you are using and pure is the only thing from
> Control.Applicative. So, you need two lines of extra code to
> express what could be expressed much more perspicuously as:
If I am reading your paragraph, I may look up 'perspicuously' and find
it in the dictionary. I have to learn about this word to understand
your paragraph? You need three extra syllables to express what could
be expressed much more clearly as: 'So, you need two lines of extra
code to express what could be expressed much more clearly as:'.
;-)
I am all for clarity in both code and prose. Excessive vocabulary use
can hinder understanding; but so can artificial restriction. In any
case, length has very little correlation with clarity.
-Brent
------------------------------
Message: 8
Date: Mon, 25 Jul 2011 12:26:51 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] a problem with maps
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Sun, Jul 24, 2011 at 04:44:55PM +0100, Julian Porter wrote:
> Well, speaking of rigour, I don't think applicative functors, etc are
> actually the right approach. Using the list monad gives a much clearer idea
> of what's going on, plus it's massively generalisable.
>
> See
> http://jpembeddedsolutions.wordpress.com/2011/07/24/combining-haskell-lists-with-monads/
> for a description.
I don't see why this implies that "applicative functors are not the
right approach". In fact,
pairThem :: Monad m => a -> m b -> m (a,b)
pairThem x ys = liftM2 (,) (return x) ys
can be made *more generic* (which you yourself state is the main goal)
as follows:
pairThem :: Applicative m => a -> m b -> m (a,b)
pairThem x ys = liftA2 (,) (pure x) ys
Since every monad is also an applicative functor, this definition
allows pairThem to be used with strictly more types.
-Brent
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 37, Issue 57
*****************************************