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: Cross-platform .hs files on Linux and Windows (Vinay Sajip)
2. Seq question (Lee Short)
3. Re: Seq question (Tim Perry)
4. Re: Cross-platform .hs files on Linux and Windows
(Henk-Jan van Tuyl)
5. Re: Cross-platform .hs files on Linux and Windows (Vinay Sajip)
6. Looking for vim text obejct plugin for haskell. (Mait)
7. Re: Looking for vim text obejct plugin for haskell. (Mait)
8. Re: Cross-platform .hs files on Linux and Windows
(Henk-Jan van Tuyl)
----------------------------------------------------------------------
Message: 1
Date: Tue, 17 Apr 2012 20:56:23 +0000 (UTC)
From: Vinay Sajip <[email protected]>
Subject: Re: [Haskell-beginners] Cross-platform .hs files on Linux and
Windows
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
> Perhaps it's a Windows 7 issue, or a 32-bit vs. 64-bit issue. I'll try on a
> different Windows 7 machine.
Actually, I face-palmed when I found what the problem was. On the 64-bit
machine, because I was short of disk space, I hadn't installed a proper editor,
and used Notepad. Of course, Notepad sticks a UTF-8 BOM at the start of the file
... removing that sorted out the problem :-)
Regards,
Vinay Sajip
------------------------------
Message: 2
Date: Tue, 17 Apr 2012 13:56:44 -0700
From: Lee Short <[email protected]>
Subject: [Haskell-beginners] Seq question
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
I've got the following code, and I'm not sure why the seq seems to be
doing nothing. The code should never terminate if the seq were forcing
the full evaluation of y. Instead, it runs just fine (though stack
overflows if I ask for too many elements of primes). I didn't see
anything in the tutorial section of haskell.org that seems to explain
this -- pointers to a useful source would be welcome.
sieve :: [Int] -> [Int]
sieve xs =
let ys = filter (\z -> 0 /= z `mod` head xs) xs
in seq ys $ head xs:sieve ys
primes = sieve [2..]
thanks
Lee
------------------------------
Message: 3
Date: Tue, 17 Apr 2012 14:41:15 -0700
From: Tim Perry <[email protected]>
Subject: Re: [Haskell-beginners] Seq question
To: [email protected]
Message-ID:
<cafvgasvz7_skotknpdthbtm0zmqexzraqxmhwh6+wgtgmvc...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
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)
You are expecting seq to work like deepseq and evaluate the entire list.
Also, mod is slower than rem and the meaning doesn't matter in a sieve so
change mod to rem for faster code.
Tim
On Tue, Apr 17, 2012 at 1:56 PM, Lee Short <[email protected]> wrote:
> I've got the following code, and I'm not sure why the seq seems to be
> doing nothing. The code should never terminate if the seq were forcing the
> full evaluation of y. Instead, it runs just fine (though stack overflows
> if I ask for too many elements of primes). I didn't see anything in the
> tutorial section of haskell.org that seems to explain this -- pointers to
> a useful source would be welcome.
>
>
> sieve :: [Int] -> [Int]
> sieve xs =
> let ys = filter (\z -> 0 /= z `mod` head xs) xs
> in seq ys $ head xs:sieve ys
>
> primes = sieve [2..]
>
> thanks
> Lee
>
>
> ______________________________**_________________
> 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/20120417/23b548af/attachment-0001.htm>
------------------------------
Message: 4
Date: Wed, 18 Apr 2012 00:31:20 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] Cross-platform .hs files on Linux and
Windows
To: [email protected], "Vinay Sajip" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
delsp=yes
On Tue, 17 Apr 2012 22:56:23 +0200, Vinay Sajip <[email protected]>
wrote:
> Actually, I face-palmed when I found what the problem was. On the 64-bit
> machine, because I was short of disk space, I hadn't installed a proper
> editor,
> and used Notepad. Of course, Notepad sticks a UTF-8 BOM at the start of
> the file
> ... removing that sorted out the problem :-)
>
But GHC should use/ignore a BOM!
Regards,
Henk-Jan van Tuyl
--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--
------------------------------
Message: 5
Date: Tue, 17 Apr 2012 23:42:16 +0000 (UTC)
From: Vinay Sajip <[email protected]>
Subject: Re: [Haskell-beginners] Cross-platform .hs files on Linux and
Windows
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Henk-Jan van Tuyl <hjgtuyl <at> chello.nl> writes:
>
> But GHC should use/ignore a BOM!
>
Right, but at least there's an easy workaround. Can you reproduce this in your
environment by prepending a BOM? If so, perhaps an issue should be logged.
Regards,
Vinay Sajip
------------------------------
Message: 6
Date: Wed, 18 Apr 2012 13:23:00 +0900
From: Mait <[email protected]>
Subject: [Haskell-beginners] Looking for vim text obejct plugin for
haskell.
To: [email protected]
Message-ID:
<cabqgwkxyhdad4_btef10n9nfswxbo9ekb-yom3jfmp0crtf...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Any good one there everybody knows except me? :)
--
Mait
------------------------------
Message: 7
Date: Wed, 18 Apr 2012 13:34:20 +0900
From: Mait <[email protected]>
Subject: Re: [Haskell-beginners] Looking for vim text obejct plugin
for haskell.
To: [email protected]
Message-ID:
<CABQgwkWcfa9mL3fSb7RkTuRG8OXhjG3q2Qke=yvp9zozoo+...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Especially looking for 'argument' object plugin.
function x:xs
^ <- cursor
ysaa) or ysia)
-> function (x:xs)
2012/4/18 Mait <[email protected]>:
> Any good one there everybody knows except me? :)
>
> --
> Mait
--
Mait
------------------------------
Message: 8
Date: Wed, 18 Apr 2012 11:49:18 +0200
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] Cross-platform .hs files on Linux
and
Windows
To: [email protected], "Vinay Sajip" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-15; format=flowed;
delsp=yes
On Wed, 18 Apr 2012 01:42:16 +0200, Vinay Sajip <[email protected]>
wrote:
> Henk-Jan van Tuyl <hjgtuyl <at> chello.nl> writes:
>
>>
>> But GHC should use/ignore a BOM!
>>
>
> Right, but at least there's an easy workaround. Can you reproduce this
> in your
> environment by prepending a BOM? If so, perhaps an issue should be
> logged.
I've already tried that; if I use Notepad to convert the file to UTF-8,
GHC does not accept the shebang.
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 29
*****************************************