Re: [Haskell-cafe] Strange subtract operator behavior - and lazy naturals

2007-10-20 Thread Luke Palmer
On 10/19/07, Yitzchak Gale <[EMAIL PROTECTED]> wrote: > So why not make the laziness available > also for cases where "1 - 2 == 0" does _not_ do > the right thing? > > data LazyInteger = IntZero | IntSum Bool Integer LazyInteger > > or > > data LazyInteger = LazyInteger Bool Nat I think data

Re: [Haskell-cafe] Re: building hslogger

2007-10-20 Thread Greg Heartsfield
Coincidentally, I just sent a patch to John for this very issue. I've attached it here, it simply updates the setup script and cabal file for Cabal 1.2. Thanks, Greg Heartsfield On Thu, Oct 18, 2007 at 09:31:51AM -0500, John Goerzen wrote: > On 2007-10-17, Chris Hayden <[EMAIL PROTECTED]> wrote:

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Alfonso Acosta
On 10/20/07, Mads Lindstrøm <[EMAIL PROTECTED]> wrote: > I am not a monad-expect, so I may be wrong, but wouldn't a writer monad > be more appropriate? You are at least more monad-expert than myself . I knew the existence of the writer monad but not really how it works. After checking its documen

Re: [Haskell-cafe] Why doesn't Hackage link to Haddock documentation anymore?

2007-10-20 Thread Conal Elliott
good news indeed! On 10/20/07, Duncan Coutts <[EMAIL PROTECTED]> wrote: > > On Fri, 2007-10-19 at 09:41 -0700, Conal Elliott wrote: > > Will hackage docs use haddock 2.0 any time soon, for libraries that > > use language extensions not supported by the older haddock? > > David Waern told me today

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Andrew Coppin
Stefan O'Rear wrote: On Sat, Oct 20, 2007 at 08:05:37PM +0100, Andrew Coppin wrote: I want to construct a program that prints out something like this: [\fx -> f(fx)] [\f -> [\x -> f(fx)]] [\f -> S[\x -> f][\x -> fx]] [\f -> S(Kf)[\x -> fx]] [\f -> S(Kf)f] S[\f -> S(Kf)][\f -> f] S(S[\f -> S]

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Stefan O'Rear
On Sat, Oct 20, 2007 at 08:05:37PM +0100, Andrew Coppin wrote: > Brent Yorgey wrote: >> >> Hmm... I'm having trouble understanding exactly what you want. In >> particular, I don't understand what this statement: >> >> "But what I *really* want is to print out the transformation *sequence*." >> >>

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Brandon S. Allbery KF8NH
On Oct 20, 2007, at 15:05 , Andrew Coppin wrote: I can quite happily construct a program which, given the first line, yields the last line. But getting it to print all the intermediate steps is harder. And, like I said, when something is "hard" in Haskell, it usually means you're doing it

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Andrew Coppin
Brent Yorgey wrote: Hmm... I'm having trouble understanding exactly what you want. In particular, I don't understand what this statement: "But what I *really* want is to print out the transformation *sequence*." has to do with the pseudocode that you exhibit later. Could you perhaps clari

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Andrew Coppin
Twan van Laarhoven wrote: How about: transform ... = (transform sub1 >>= put back into main expression) ++ (transform sub2 >>= put back into main expression) Or something to that effect? Or maybe transform ... = do sub' <- transform sub1 ++ transform sub2 put

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Brent Yorgey
On 10/20/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: > > I'm writing some code where I take an expression tree and transform it > into another equivilent one. > > Now it's moderately easy to write the code that does the transformation. > But what I *really* want is to print out the transformation

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Mads Lindstrøm
Hi Alfonso & Andrew Alfonso Acosta wrote: > How about using a state monad as a logger? I am not a monad-expect, so I may be wrong, but wouldn't a writer monad be more appropriate? After all, it is just used for logging the intermediate results, not to keep read/write state. In other words, we jus

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Twan van Laarhoven
Andrew Coppin wrote: I'm writing some code where I take an expression tree and transform it into another equivilent one. Now it's moderately easy to write the code that does the transformation. But what I *really* want is to print out the transformation *sequence*. This appears to be much mor

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Andrew Coppin
Alfonso Acosta wrote: How about using a state monad as a logger? You store the transformation sequence in the state while processing the tree, then you simply retrieve the state and print it out. Mmm... that could work... I'll investigate. Thanks. _

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Alfonso Acosta
How about using a state monad as a logger? You store the transformation sequence in the state while processing the tree, then you simply retrieve the state and print it out. Your transformation function should change to > import Control.Monad.State > > data Log = ... -- to be defined > > type Lo

[Haskell-cafe] Transformation sequence

2007-10-20 Thread Andrew Coppin
I'm writing some code where I take an expression tree and transform it into another equivilent one. Now it's moderately easy to write the code that does the transformation. But what I *really* want is to print out the transformation *sequence*. This appears to be much more awkward. What I ha

[Haskell-cafe] A possibly stupid doubt about the GHC's overlapping instances flag's

2007-10-20 Thread Rodrigo Geraldo
Hi! Suppose that the GHC's flag -fallow-incoherent-instances is enabled. In this situation, when a instance will be rejected? And if the flag -fallow-overlapping-instances is enabled. When a instance will be rejected? Thanks! Rodrigo ___ Haskell-Cafe m

Re: [Haskell-cafe] Why doesn't Hackage link to Haddock documentation anymore?

2007-10-20 Thread Duncan Coutts
On Fri, 2007-10-19 at 09:41 -0700, Conal Elliott wrote: > Will hackage docs use haddock 2.0 any time soon, for libraries that > use language extensions not supported by the older haddock? David Waern told me today that he's working on a new patch to integrate haddock-2.0 support into Cabal. So whe

Re: [Haskell-cafe] SYB3 codebase

2007-10-20 Thread Greg Meredith
Mads, Many thanks for your help. i really appreciate it. Best wishes, --greg On 10/19/07, Mads Lindstrøm <[EMAIL PROTECTED]> wrote: > > Hi Greg > > I forgot to say, that I did not stop using the Shelarcy patch because > there was something wrong with the code. On the contrary it served me > wel

Re: [Haskell-cafe] SYB3 codebase

2007-10-20 Thread Ian Lynagh
On Fri, Oct 19, 2007 at 07:59:37PM +0200, Mads Lindstrøm wrote: > > http://hackage.haskell.org/cgi-bin/hackage-scripts/package/syb-with-class-0.3 > (hereafter know as HappS-SYB3). HappS-SYB3 is based on the SYB3 code > you mention, but the code has been changed quite a bit compared to > using the

[Haskell-cafe] Re: Hiding side effects in a data structure

2007-10-20 Thread Jon Fairbairn
Simon Peyton-Jones <[EMAIL PROTECTED]> writes: > I realise belatedly that my message might have sounded > dismissive. My apologies; it wasn't intended to be. Good > ideas are just that: good. Reinventing them is a sign of > good taste. > > As to documenting GHC, we try to do that by writing pap