[Haskell-cafe] Simulation and GHC Thread Scheduling

2009-05-08 Thread Thomas DuBuisson
All, I have a simple Haskell P2P library that I've been playing with in simulations of 20 to 600 nodes. To run the simulation there is a Haskell thread (forkIO) for every node in the system, one that starts up all the nodes and prints the info (so prints aren't mangled), and one that acts as the

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Don Stewart
Andy Gill has been advocating programmatic access to the 'is evaluated' status bit for years now. 'seq' becomes cheaper, and we can write operational properties/assertions about strictness. -- Don jochem: > Nikhil Patil wrote: > > Hi, > > > > I am curious to know if there is a function in Haskel

Re: [Haskell-cafe] GC

2009-05-08 Thread Andrew Coppin
John Lask wrote: on the other hand a function to release pool memory to the OS down to the current active level should (I hope) be easily implementable, and quickly incorporated into application where required, whereas arriving at one or more automatic deallocation policies would most likely r

RE: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Sittampalam, Ganesh
Brandon S. Allbery KF8NH wrote: > On May 8, 2009, at 13:08 , Sittampalam, Ganesh wrote: >> Brandon S. Allbery KF8NH wrote: >>> and therefore must be in IO. You may be thinking that it would >>> return a result for _|_, but as described if you fed it _|_ it could >>> only produce False (if the _|_

Re: [Haskell-cafe] Darcs as undo/redo system?

2009-05-08 Thread Jeremy Shaw
At Fri, 8 May 2009 17:33:25 +0200, Peter Verswyvelen wrote: > > [1 ] > [1.1 ] > If you work with a text editor like Microsoft Visual Studio (maybe also > Eclipse, don't know), each text editor has its own undo/redo history. > However, when you perform refactoring - like renaming a function - thi

[Haskell-cafe] ANNOUNCE: hpc-strobe-0.1: Hpc-generated strobes for a running Haskell program

2009-05-08 Thread Thorkil Naur
I am pleased to announce the initial release of hpc-strobe: Hpc-generated strobes for a running Haskell program. hpc-strobe is a rudimentary library that demonstrates the possibility of using Hpc (Haskell Program Coverage) to inspect the state of a running Haskell program. hpc-strobe-0.1 has bee

Can HLint help spot space leaks? (was: Re: [Haskell-cafe] Generating Haskell with associated types (and kind annotations))

2009-05-08 Thread Jason Dagit
On Fri, May 8, 2009 at 8:49 AM, Neil Mitchell wrote: > > I've used the project extensively in HLint > (http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hlint) and > it works fantastically. Hi Neil, A bit off-topic, but your post reminded me: Does HLint currently help the user find s

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Daniel Fischer
Am Freitag 08 Mai 2009 19:18:37 schrieb Brandon S. Allbery KF8NH: > On May 8, 2009, at 12:00 , Neil Brown wrote: > > If you change fromInteger in Num Bool to be fromInteger x = x /= 0, > > then we could all start writing nasty C-like if-expressions... > > I'd be strongly tempted to say > > > fromI

Re: [Haskell-cafe] Darcs as undo/redo system?

2009-05-08 Thread Gwern Branwen
On Fri, May 8, 2009 at 12:43 PM, Jason Dagit wrote: > Hi Peter, > > On Fri, May 8, 2009 at 8:33 AM, Peter Verswyvelen wrote: >> If you work with a text editor like Microsoft Visual Studio (maybe also >> Eclipse, don't know), each text editor has its own undo/redo history. >> However, when you per

Re: [Haskell-cafe] Generating Haskell with associated types (and kind annotations)

2009-05-08 Thread Daniel Peebles
Hi Neil, Thanks for the suggestion! I'd seen the package before, but I couldn't figure out a good way to integrate it into my codegen situation. I guess I should write the "skeleton" of the code I want to generate, get HSE to parse it, and then replace the parts I want to change of the AST with w

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Brandon S. Allbery KF8NH
On May 8, 2009, at 13:08 , Sittampalam, Ganesh wrote: Brandon S. Allbery KF8NH wrote: and therefore must be in IO. You may be thinking that it would return a result for _|_, but as described if you fed it _|_ it could only produce False (if the _|_ has been evaluated you would not be able to re

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Brandon S. Allbery KF8NH
On May 8, 2009, at 12:00 , Neil Brown wrote: If you change fromInteger in Num Bool to be fromInteger x = x /= 0, then we could all start writing nasty C-like if-expressions... I'd be strongly tempted to say > fromInteger = const False -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell

RE: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Sittampalam, Ganesh
Brandon S. Allbery KF8NH wrote: > On May 8, 2009, at 01:33 , Joe Fredette wrote: >> That strikes me as being bad in a "I'm violating the Halting Problem" >> sort of way- but I'm not sure how. Is there some contradictory >> construction that could be built from such a function? > > I don't think it

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Joe Fredette
That must have been the vibe I was getting. My haskell-spider senses were tingling, I just overshot RT and went for the Halting Problem. /Joe Brandon S. Allbery KF8NH wrote: On May 8, 2009, at 01:33 , Joe Fredette wrote: That strikes me as being bad in a "I'm violating the Halting Problem" so

Re: [Haskell-cafe] Re: Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)

2009-05-08 Thread Kalman Noel
Daniel Carrera schrieb: > I think it largely depends on the learner. Some people find vocabulary > easier, or more interesting, others not. I have a hard time learning a > lot of isolated facts (e.g. vocabulary), but I find it easier and more > enjoyable to learn a rule that I can apply many times.

[Haskell-cafe] OT: Languages (was: Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink))

2009-05-08 Thread Kalman Noel
wren ng thornton schrieb: > Chris Forno (jekor) wrote: >> That being said, Esperanto, and even Japanese sentence structure perhaps >> is not as different as an agglutinative language like German. I'll need >> to study it more to find out. > > Actually, Japanese is agglutinative too (moreso than Ge

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Brandon S. Allbery KF8NH
On May 8, 2009, at 01:33 , Joe Fredette wrote: That strikes me as being bad in a "I'm violating the Halting Problem" sort of way- but I'm not sure how. Is there some contradictory construction that could be built from such a function? I don't think it is; surely the Haskell runtime knows wh

Re: [Haskell-cafe] Darcs as undo/redo system?

2009-05-08 Thread Jason Dagit
Hi Peter, On Fri, May 8, 2009 at 8:33 AM, Peter Verswyvelen wrote: > If you work with a text editor like Microsoft Visual Studio (maybe also > Eclipse, don't know), each text editor has its own undo/redo history. > However, when you perform refactoring - like renaming a function - this > becomes

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread John Dorsey
> > Does that also mean that you could write: > > > > if 3 - 4 then ... else ...  (= if (fromInteger 3 :: Bool) - (fromInteger 4 > > :: Bool) then ... else ...) > > No. 3 - 4 is an Integer, the proposal is to convert Bools to Ints, not > Ints to Bools. Rather, (3 - 4) is a "(Num t) => t", so yes,

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Neil Mitchell
> Does that also mean that you could write: > > if 3 - 4 then ... else ...  (= if (fromInteger 3 :: Bool) - (fromInteger 4 > :: Bool) then ... else ...) No. 3 - 4 is an Integer, the proposal is to convert Bools to Ints, not Ints to Bools. Of course, Lennart has been asking for precisely this funct

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Neil Brown
Neil Mitchell wrote: I didn't at first, then I remembered: 1 + True = fromInteger 1 + True And if we have Num for Bool, it type checks. Does that also mean that you could write: if 3 - 4 then ... else ... (= if (fromInteger 3 :: Bool) - (fromInteger 4 :: Bool) then ... else ...) or per

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Neil Mitchell
Nope, it's in the Haskell standard. It means we can type: 1 + (2 :: Int) and have it work Otherwise what type would 1 have? Integer? Float? It's just a way of giving constants the type :: Num a => a On Fri, May 8, 2009 at 4:53 PM, Andrew Wagner wrote: > Hmm, I never knew that. Is that a GHC thi

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Andrew Wagner
Hmm, I never knew that. Is that a GHC thing? Is it strictly necessary? Seems like it could be done in the Num instance for Integers, Ints, etc. On Fri, May 8, 2009 at 11:51 AM, Neil Mitchell wrote: > > Err, I'm not seeing the danger of this > > (+) :: forall a. (Num a) => a -> a -> a > > Doesn't

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Neil Mitchell
> Err, I'm not seeing the danger of this > (+) :: forall a. (Num a) => a -> a -> a > Doesn't this require the two parameters to be the same instance of Num? I didn't at first, then I remembered: 1 + True = fromInteger 1 + True And if we have Num for Bool, it type checks. Thanks Neil __

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Andrew Wagner
Err, I'm not seeing the danger of this (+) :: forall a. (Num a) => a -> a -> a Doesn't this require the two parameters to be the same instance of Num? On Fri, May 8, 2009 at 10:51 AM, Sittampalam, Ganesh < ganesh.sittampa...@credit-suisse.com> wrote: > Stephan Friedrichs wrote: > > > When lookin

Re: [Haskell-cafe] Generating Haskell with associated types (and kind annotations)

2009-05-08 Thread Neil Mitchell
Hi Dan, > I was wondering whether anyone had any suggestions on a good way to > generate repetitive code with associated types and kind annotations. haskell-src-exts is the answer: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskell-src-exts >From the project description: "Haskel

[Haskell-cafe] Darcs as undo/redo system?

2009-05-08 Thread Peter Verswyvelen
If you work with a text editor like Microsoft Visual Studio (maybe also Eclipse, don't know), each text editor has its own undo/redo history. However, when you perform refactoring - like renaming a function - this becomes an undo/redo on multiple files together, so in a sense these changes are part

Re: [Haskell-cafe] commending "Design concepts in programming languages"

2009-05-08 Thread Daniel Fischer
Am Freitag 08 Mai 2009 15:51:28 schrieb Miguel Mitrofanov: > j.waldmann wrote on 08.05.2009 17:39: > > Wow. This is really a bikeshed discussion. My post contained praise for > > the book, > > a critique of one of its design decisions (intermediate language not > > explicitely typed), > > and a syn

[Haskell-cafe] Generating Haskell with associated types (and kind annotations)

2009-05-08 Thread Daniel Peebles
Hi all, I was wondering whether anyone had any suggestions on a good way to generate repetitive code with associated types and kind annotations. I'd like to use TH but as far as I understand, it doesn't support this yet (I think associated types are in HEAD but not kinds), so for now I've been usi

RE: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Sittampalam, Ganesh
Stephan Friedrichs wrote: > When looking for an xor function, I found one in Data.Bits but > couldn't use it for Bool, because Bool is no instance of Bits and of > Num (which would be necessary, because it's "class (Num b) => Bits > b"). My question is: Why not? > > [...] > quite trivial... Why

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Stephan Friedrichs
Deniz Dogan wrote: >> instance Num Bool where >>(+) False = id >>(+) True = not >> >>(*) True True = True >>(*) _ _= False >> > > Isn't "XOR" for booleans (/=)? Oh right. And (*) would be (&&): instance Num Bool where (+) = (/=) (*) = (&&) -- ... //Stephan

Re: [Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Deniz Dogan
2009/5/8 Stephan Friedrichs : > Hi! > > When looking for an xor function, I found one in Data.Bits but couldn't > use it for Bool, because Bool is no instance of Bits and of Num (which > would be necessary, because it's "class (Num b) => Bits b"). My question > is: Why not? > > We could declare > >

[Haskell-cafe] Why is Bool no instance of Num and Bits?

2009-05-08 Thread Stephan Friedrichs
Hi! When looking for an xor function, I found one in Data.Bits but couldn't use it for Bool, because Bool is no instance of Bits and of Num (which would be necessary, because it's "class (Num b) => Bits b"). My question is: Why not? We could declare instance Num Bool where (+) False = id

[Haskell-cafe] Poking fun at haskell and other programming languages

2009-05-08 Thread Andrew Wagner
http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: monad . comonad = id

2009-05-08 Thread Ertugrul Soeylemez
Hello Jan, the principle of duality in category theory is not like "being the inverse", but more like "stating the same somewhere else". To each category there is an opposite category, which is just the same, but with all arrows flipped. A comonad in the original category is then a monad in the

Re: [Haskell-cafe] commending "Design concepts in programming languages"

2009-05-08 Thread Miguel Mitrofanov
j.waldmann wrote on 08.05.2009 17:39: Wow. This is really a bikeshed discussion. My post contained praise for the book, a critique of one of its design decisions (intermediate language not explicitely typed), and a syntactical remark. Guess what the discussion is about. (This is also known as

Re: [Haskell-cafe] commending "Design concepts in programming languages"

2009-05-08 Thread j.waldmann
Wow. This is really a bikeshed discussion. My post contained praise for the book, a critique of one of its design decisions (intermediate language not explicitely typed), and a syntactical remark. Guess what the discussion is about. (This is also known as http://www.haskell.org/haskellwiki/Wadler

Re: [Haskell-cafe] commending "Design concepts in programming languages"

2009-05-08 Thread Daniel Fischer
Am Freitag 08 Mai 2009 13:23:09 schrieb Wolfgang Jeltsch: > Am Donnerstag, 7. Mai 2009 14:42 schrieb Daniel Fischer: > > Of course, if centuries ago people had decided to write the argument > > before the function, composition would've been defined the other way > > round. They haven't. > > Algebra

Re: [Haskell-cafe] monad . comonad = id

2009-05-08 Thread Miguel Mitrofanov
Seems like I was wrong. It does satisfy comonad laws. Sorry. However, the "duality" of monads and comonads isn't that simple. A comonad is actually a monad itself, but in different category. It has nothing to do with inverse functions etc. Jan Christiansen wrote on 08.05.2009 14:47: Hi, I ha

Re: [Haskell-cafe] monad . comonad = id

2009-05-08 Thread Jan Christiansen
Hi, On 08.05.2009, at 13:14, Miguel Mitrofanov wrote: I have a question regarding the connection between monads and comonads. I always thought of the comonad operations as being the inverse operations of the corresponding monad functions. That's not true. I thought there is some kind of

Re: [Haskell-cafe] commending "Design concepts in programming languages"

2009-05-08 Thread Wolfgang Jeltsch
Am Donnerstag, 7. Mai 2009 14:42 schrieb Daniel Fischer: > Of course, if centuries ago people had decided to write the argument before > the function, composition would've been defined the other way round. > They haven't. Algebraists used to write x f instead of f(x) at least in the 1980s. I think

Re: [Haskell-cafe] monad . comonad = id

2009-05-08 Thread Miguel Mitrofanov
I have a question regarding the connection between monads and comonads. I always thought of the comonad operations as being the inverse operations of the corresponding monad functions. That's not true. If this is the case I would like to know what the corresponding monad for the following com

[Haskell-cafe] monad . comonad = id

2009-05-08 Thread Jan Christiansen
Hi, I have a question regarding the connection between monads and comonads. I always thought of the comonad operations as being the inverse operations of the corresponding monad functions. As I do not know the underlying theory I thought I simply ask the masters. Is there a formal verific

Re[4]: [Haskell] Re[2]: [Haskell-cafe] Is Haskell a Good Choice for Web Applications? (ANN: Vocabulink)

2009-05-08 Thread Bulat Ziganshin
Hello Jason, Thursday, May 7, 2009, 9:06:33 PM, you wrote: >> you are right again. so, that remains: you shouldn't suppose that >> user have read 90's GC paper. give a short excerpt of it: how >> generational GC works and how memory usage converts to memory >> footprint. then descriptions of RTS

Re[2]: [Haskell] Re[2]: [Haskell-cafe] Is Haskell a Good Choice for WebApplications? (ANN: Vocabulink)

2009-05-08 Thread Bulat Ziganshin
Hello Ketil, Friday, May 8, 2009, 10:49:23 AM, you wrote: >> FWIW, the JVM also fails to release memory resources back to the >> OS. Given all the problems I've seen that one cause for long-running >> processes, I'm definitely in support of correcting any behavior like >> this in the GHC RTS. >

Re: [Haskell-cafe] is value evaluated?

2009-05-08 Thread Ketil Malde
Nikhil Patil writes: > I am curious to know if there is a function in Haskell to find if a certain > value has already been evaluated. The function I need would have the type: > >> (?!) :: a -> Bool Well, obviously you can't do this, it would violate referential transparency. Except if you defi