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: Named Pipes Et Cetera (matthew coolbeth)
2. Re: Exception back trace (Paul Sargent)
3. Re: Exception back trace (Brandon S Allbery KF8NH)
4. Re: defining 'init' in terms of 'foldr' (Chadda? Fouch?)
5. Re: Exception back trace (Paul Sargent)
----------------------------------------------------------------------
Message: 1
Date: Sun, 5 Dec 2010 09:57:03 -0500
From: matthew coolbeth <[email protected]>
Subject: Re: [Haskell-beginners] Named Pipes Et Cetera
To: Brandon S Allbery KF8NH <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="UTF-8"
As Mr Therning suggested, I switched over from System.IO.openFile to
openFd in System.Posix.
This gives the blocking behavior that I want. The only downside was
having to provide my own readLine.
Just so everyone knows.
thanks,
mac
On 2010-12-03, Brandon S Allbery KF8NH <[email protected]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 11/23/10 10:36 , Patrick LeBoutillier wrote:
>> The Glorious Glasgow Haskell Compilation System, version 6.10.1
>
> IIRC this was in fact broken in 6.10.1; upgrade at least to 6.10.3.
>
> - --
> brandon s. allbery [linux,solaris,freebsd,perl] [email protected]
> system administrator [openafs,heimdal,too many hats] [email protected]
> electrical and computer engineering, carnegie mellon university KF8NH
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.10 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkz5THAACgkQIn7hlCsL25VOEQCgp/fPxHTsFb6vAeaO1GGonZDc
> dh8AmgIy4l0khXTHliySwRSnz804tu0Z
> =m7l1
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
--
mac
------------------------------
Message: 2
Date: Sun, 5 Dec 2010 15:12:04 +0000
From: Paul Sargent <[email protected]>
Subject: Re: [Haskell-beginners] Exception back trace
To: Michael Snoyman <[email protected]>
Cc: [email protected], beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Wrong way to solve the problem in my opinion. Making source code modifications
so that you can know which call to minimum got an empty list seems backwards.
At the very least we should be able to get a file & line number. Can't we?
(Just to be clear, I don't have a solution, but I've hit the same problem)
On 5 Dec 2010, at 14:36, Michael Snoyman wrote:
> You might want to try out monadloc[1] and control-monad-exception[2],
> which provide some monadic stack traces via a preprocessor.
>
> Michael
>
> [1] http://hackage.haskell.org/package/monadloc
> [2] http://hackage.haskell.org/package/control-monad-exception
>
> On Sun, Dec 5, 2010 at 2:49 AM, Russ Abbott <[email protected]> wrote:
>> Hi,
>> I am in the midst of debugging and got an exception:
>>
>> *** Exception: Prelude.minimum: empty list
>>
>> That's all it said. There was no information about where the exception
>> occurred. Is it possible to ask for more information, preferably including a
>> stack trace?
>> Thanks.
>>
>> -- Russ
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
------------------------------
Message: 3
Date: Sun, 05 Dec 2010 12:02:51 -0500
From: Brandon S Allbery KF8NH <[email protected]>
Subject: Re: [Haskell-beginners] Exception back trace
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/5/10 10:12 , Paul Sargent wrote:
> Wrong way to solve the problem in my opinion. Making source code
> modifications so that you can know which call to minimum got an empty list
> seems backwards.
>
> At the very least we should be able to get a file & line number. Can't we?
Problem is that lazy evaluation makes the whole notion fuzzy; the error is
likely to be triggered in a thunk at a location related to the error only by
the fact that it forced the thunk to be evaluated.
- --
brandon s. allbery [linux,solaris,freebsd,perl] [email protected]
system administrator [openafs,heimdal,too many hats] [email protected]
electrical and computer engineering, carnegie mellon university KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkz7xbsACgkQIn7hlCsL25WbkACfRVYSyaif/VU9GOnVfCr+SOHX
9p0AoK7t/Hks7d0LaWJuwRHIXYeV/5Hs
=iO36
-----END PGP SIGNATURE-----
------------------------------
Message: 4
Date: Sun, 5 Dec 2010 19:04:27 +0100
From: Chadda? Fouch? <[email protected]>
Subject: Re: [Haskell-beginners] defining 'init' in terms of 'foldr'
To: Hein Hundal <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=UTF-8
On Sun, Dec 5, 2010 at 3:51 PM, Hein Hundal <[email protected]> wrote:
> ?I am trying to understand the differences between two
> different solutions to the problem of expressing init in
> terms of foldr.
>
> ?The two solutions are called heinInit and chaddiInit.
> The heinInit does not work on infinite lists. ?The
> chaddiaiInit function does work on infinite lists.
>
>
> heinInit v = fromJust $ foldr f Nothing v
> ? where
> ? ? ?f a Nothing = Just []
> ? ? ?f a (Just v) = Just (a:v)
>
>
> chaddaiInit v = fromJust $ foldr f Nothing v
> ? where
> ? ? ?f x xs = Just (case xs of Nothing -> []; Just ys -> x:ys)
>
> <<snip>>
>
> And it just keeps going. ?Is this the right idea? ?Are my
> "traces" a reasonable estimate of how Haskell
> evaluates those expressions?
Pretty good :-)
Another way to see it is that my solution provides information
earlier, in yours f needs to know whether its second argument was
Nothing or Just before it returns any information on its result, in
mine f start by "saying" it is a Just something even before it
examines its arguments. Using traces like you just did is the best way
to get reliable results (and you'll be able to run them in your head
with a bit more experience), but having intuition on the degree of
laziness of a function can help too. Most of the time it is better to
start out as lazy as possible (a good trick is to see if it will work
on infinite data structure), with experience you'll recognize the
points where strictness is needed instead.
--
Jeda?
------------------------------
Message: 5
Date: Mon, 6 Dec 2010 00:20:43 +0000
From: Paul Sargent <[email protected]>
Subject: Re: [Haskell-beginners] Exception back trace
To: Brandon S Allbery KF8NH <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On 5 Dec 2010, at 17:02, Brandon S Allbery KF8NH wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 12/5/10 10:12 , Paul Sargent wrote:
>> Wrong way to solve the problem in my opinion. Making source code
>> modifications so that you can know which call to minimum got an empty list
>> seems backwards.
>>
>> At the very least we should be able to get a file & line number. Can't we?
>
> Problem is that lazy evaluation makes the whole notion fuzzy; the error is
> likely to be triggered in a thunk at a location related to the error only by
> the fact that it forced the thunk to be evaluated.
Ok, but tag each thunk with the code location that generated it, and then when
thunk triggers thunk triggers thunk isn't that your stack trace.
Obviously you'd only do this when debugging code, but that's like adding debug
symbols to C compilation.
I'm being simplistic I know, but what am I missing? Are we talking about too
much info attached to too many thunks?
(Personally I've taken to using the Safe module
<http://hackage.haskell.org/packages/archive/safe/0.3/doc/html/Safe.html> to
get around this fact that some Prelude functions can fail. That way I can
either write functions that can't fail, or I can define my own messages so that
the error message is useful. Alternatively, I sometimes use Debug.Trace, but
that isn't always that easy to insert, and you have to be careful what you
decide to print out as it can cause things to be evaluated.)
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 30, Issue 8
****************************************