[Haskell-cafe] Obscure weirdness

2009-06-20 Thread Andrew Coppin
OK, so here's an interesting problem... I've been coding away all day, but now my program is doing something slightly weird. For a specific input, it summarily terminates. The registered exception handler does not fire. There is no output to stdout or stderr indicating what the problem is. It

Re: [Haskell-cafe] Obscure weirdness

2009-06-20 Thread Alexander Dunlap
On Sat, Jun 20, 2009 at 8:29 AM, Andrew Coppin andrewcop...@btinternet.com wrote: OK, so here's an interesting problem... I've been coding away all day, but now my program is doing something slightly weird. For a specific input, it summarily terminates. The registered exception handler

Re: [Haskell-cafe] Obscure weirdness

2009-06-20 Thread Andrew Coppin
Alexander Dunlap wrote: On Sat, Jun 20, 2009 at 8:29 AM, Andrew Coppin andrewcop...@btinternet.com wrote: OK, so here's an interesting problem... I've been coding away all day, but now my program is doing something slightly weird. For a specific input, it summarily terminates. The

Re: [Haskell-cafe] Obscure weirdness

2009-06-20 Thread Ross Mellgren
Really, without code or more than it just disappears, it's just conjecture what's happening. Can you post the code, or even better yet a minimized case that reproduces it? -Ross On Jun 20, 2009, at 1:34 PM, Andrew Coppin wrote: Alexander Dunlap wrote: On Sat, Jun 20, 2009 at 8:29 AM,

[Haskell-cafe] unique identity and name shadowing during type inference

2009-06-20 Thread Geoffrey Irving
Hello, I am designing a type inference algorithm for a language with arbitrary function overloading. For various reasons (beyond the scope of this email), it's impossible to know the full type of an overloaded function, so each function is assigned a unique primitive type and the inference

Re: [Haskell-cafe] Tree Semantics and efficiency

2009-06-20 Thread Conal Elliott
Moreover, copying is not even meaningful in a functional setting. A data structure is indistinguishable from a copy of the data structure. In languages that allow mutation of data, one has to carefully copy data to avoid accidental mutation by other computations. Disallow data mutation, and the

[Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Deniz Dogan
I (too) often find myself writing code such as this: if something then putStrLn howdy there! else if somethingElse then putStrLn howdy ho! else ... I recall reading some tutorial about how you can use the Maybe monad if your code starts looking like this, but as you can

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-20 Thread Thomas Hartman
could someone explain sharing? In the code below, allstrings2 is 6X as fast as allstrings. I assume because of sharing, but I don't intuitively see a reason why. can someone give me some pointers, perhaps using debug.trace or other tools (profiling?) to show where the first version is being

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-20 Thread Miguel Mitrofanov
Well, I'm hardly the one knowing GHC internals, but... In allstrings you continue calling strings with same arguments again and again. Don't fool yourself, it's not going to automagically memorize what you were doing before. In fact, I'd expect much more speed loss. If you increase your

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Stephan Friedrichs
Deniz Dogan wrote: I (too) often find myself writing code such as this: if something then putStrLn howdy there! else if somethingElse then putStrLn howdy ho! else ... [...] So how do I make code like this prettier? If it's a function, you can use guards: foo

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Jeremy Shaw
At Sat, 20 Jun 2009 20:45:16 +0200, Stephan Friedrichs wrote: If it's a function, you can use guards: foo :: ... foo something somethingElse | something - putStrLn howdy there! | somethingElse - putStrLn howdy ho! | otherwise - ... You can also artificially introduce

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Antoine Latter
On Sat, Jun 20, 2009 at 1:05 PM, Deniz Dogandeniz.a.m.do...@gmail.com wrote: I (too) often find myself writing code such as this: if something  then putStrLn howdy there!  else if somethingElse          then putStrLn howdy ho!          else ... I recall reading some tutorial about how you

Re: [Haskell-cafe] Obscure weirdness

2009-06-20 Thread Marcin Kosiba
On Saturday 20 June 2009, Andrew Coppin wrote: OK, so here's an interesting problem... I've been coding away all day, but now my program is doing something slightly weird. For a specific input, it summarily terminates. The registered exception handler does not fire. There is no output to

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Daniel Peebles
The when and unless functions might come in handy too (both have type forall (m :: * - *). (Monad m) = Bool - m () - m ()) On Sat, Jun 20, 2009 at 2:05 PM, Deniz Dogandeniz.a.m.do...@gmail.com wrote: I (too) often find myself writing code such as this: if something  then putStrLn howdy there!

Re: [Haskell-cafe] Re: Wiki user accounts

2009-06-20 Thread Gwern Branwen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Ok, we now have 3 people with createaccount: http://haskell.org/haskellwiki/?title=Special%3AListusersgroup=createaccountusername= myself byorgey Magnus (Neil Mitchell and Don Stewart having not accepted/declined in this thread.) Does anyone

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Jochem Berndsen
Antoine Latter wrote: On Sat, Jun 20, 2009 at 1:05 PM, Deniz Dogandeniz.a.m.do...@gmail.com wrote: I (too) often find myself writing code such as this: if something then putStrLn howdy there! else if somethingElse then putStrLn howdy ho! else ... I recall reading some

Re: [Haskell-cafe] Obscure weirdness

2009-06-20 Thread Andrew Coppin
Marcin Kosiba wrote: On Saturday 20 June 2009, Andrew Coppin wrote: OK, so here's an interesting problem... I've been coding away all day, but now my program is doing something slightly weird. For a specific input, it summarily terminates. The registered exception handler does not fire.

Re: [Haskell-cafe] unique identity and name shadowing during type inference

2009-06-20 Thread Lennart Augustsson
Use 1. You'll probably need a monad in the type checker soon or later anyway, e.g., for handling errors. On Sat, Jun 20, 2009 at 7:57 PM, Geoffrey Irvingirv...@naml.us wrote: Hello, I am designing a type inference algorithm for a language with arbitrary function overloading.  For various

Re: [Haskell-cafe] Obscure weirdness

2009-06-20 Thread Lennart Augustsson
Did you try running it in some debugger, like windbg or VS? 2009/6/20 Andrew Coppin andrewcop...@btinternet.com: Marcin Kosiba wrote: On Saturday 20 June 2009, Andrew Coppin wrote: OK, so here's an interesting problem... I've been coding away all day, but now my program is doing something

Re: [Haskell-cafe] Code walking off the right edge of the screen

2009-06-20 Thread Brandon S. Allbery KF8NH
On Jun 20, 2009, at 14:05 , Deniz Dogan wrote: if something then putStrLn howdy there! else if somethingElse then putStrLn howdy ho! else ... FWIW, when I see this I generally start looking for a higher order way to express it. The monoid instance for lists can be a good

[Haskell-cafe] ANN: haskeline-class

2009-06-20 Thread Antoine Latter
I'd like to announce a small library newly on hackage: haskeline-class http://hackage.haskell.org/package/haskeline-class Haskeline is an easy to use library, with a reasonable interface. The one quirk that got in my way was that its 'InputT' monad transformer defined its own instance of

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-20 Thread wren ng thornton
Thomas Hartman wrote: could someone explain sharing? In the code below, allstrings2 is 6X as fast as allstrings. I assume because of sharing, but I don't intuitively see a reason why. can someone give me some pointers, perhaps using debug.trace or other tools (profiling?) to show where the

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-20 Thread Matthew Brecknell
Thomas Hartman wrote: could someone explain sharing? A good tool for visualising the difference between shared and non-shared results would be vacuum, using one of its front ends, vacuum-cairo or vacuum-ubigraph. http://hackage.haskell.org/package/vacuum