[Haskell-cafe] pattern matching on date type

2009-01-01 Thread Max.cs
thanks! suppose we have data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving Show and how I could define a function foo :: a - Tree a that foo a = Leaf a where a is not a type of Tree foo b = b where b is one of the type of Tree (Leaf or Branch) ? The following

[Haskell-cafe] Re: [Haskell-beginners] pattern matching on date type

2009-01-01 Thread Alexander Dunlap
On Thu, Jan 1, 2009 at 12:36 AM, Max.cs max.cs.2...@googlemail.com wrote: thanks! suppose we have data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving Show and how I could define a function foo :: a - Tree a that foo a = Leaf a where a is not a type of Tree foo b = b

Re: [Haskell-cafe] pattern matching on date type

2009-01-01 Thread Bulat Ziganshin
Hello Max.cs, Thursday, January 1, 2009, 11:36:24 AM, you wrote: seems that you come from dynamic languages :) Haskell has static typing meaning that your function can accept either Tree or a as arguments. so you should convert a to Tree explicitly, using Leaf thanks!  

[Haskell-cafe] Re: Updating doubly linked lists

2009-01-01 Thread Apfelmus, Heinrich
S. Günther wrote: Untying the knot was (and still is) exactly the problem I was facing. I knew that the whole list had to be rebuild and wasn't concerned with performance since at that point I just wanted to know how to do it and if it is possible at all. After I realized that it maybe just to

[Haskell-cafe] Re: [Haskell-beginners] pattern matching on date type

2009-01-01 Thread Thomas Davie
On 1 Jan 2009, at 09:36, Max.cs wrote: thanks! suppose we have data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving Show and how I could define a function foo :: a - Tree a that foo a = Leaf a where a is not a type of Tree foo b = b where b is one of the type

Re: [Haskell-cafe] WriterT [w] IO is not lazy in reading [w]

2009-01-01 Thread Ryan Ingram
2008/12/31 Paolino paolo.verone...@gmail.com: I must ask why runWriterT k :: State s (a,[Int]) is working. Looks like I could runIO the same way I evalState there. In that case I wouldn't wait for the State s action to finish. Thanks Assuming you have Control.Monad.State.Lazy (which I think

[Haskell-cafe] [ANN] Haskell web server + wiki: salvia-0.0.4 + orchid-0.0.6

2009-01-01 Thread Sebastiaan Visser
Happy new year, you all! I'm pleased to announce three new packages on Hackage: * salvia-0.0.4: A lightweight modular web server framework. * orchid-0.0.6: A(nother) Wiki written in Haskell, currently using Darcs as a versioning back-end and Salvia as the application server. Orchid

Re: [Haskell-cafe] [ANN] Haskell web server + wiki: salvia-0.0.4 + orchid-0.0.6

2009-01-01 Thread Gwern Branwen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On Thu, Jan 1, 2009 at 9:04 AM, Sebastiaan Visser wrote: Happy new year, you all! I'm pleased to announce three new packages on Hackage: * salvia-0.0.4: A lightweight modular web server framework. * orchid-0.0.6: A(nother) Wiki written in

Re: [Haskell-cafe] hackage, gtk2hs

2009-01-01 Thread Peter Gavin
Cetin Sert wrote: Hi, A package I want to upload only builds with the unreleased gtk2hs version from the darcs repository and not the latest released version 0.9.13 or any lesser. But the repository version seems to not have changed, so if I say in my cabal file: gtk = 0.9.14 it does not

Re: [Haskell-cafe] [ANN] Haskell web server + wiki: salvia-0.0.4 + orchid-0.0.6

2009-01-01 Thread Sebastiaan Visser
On Jan 1, 2009, at 7:15 PM, Gwern Branwen wrote: On Thu, Jan 1, 2009 at 9:04 AM, Sebastiaan Visser wrote: Happy new year, you all! I'm pleased to announce three new packages on Hackage: ... Miscellaneous comments: 1) You're right about cabal-install versus runhaskell etc. There seems to be

Re: [Haskell-cafe] WriterT [w] IO is not lazy in reading [w]

2009-01-01 Thread Derek Elkins
On Thu, 2009-01-01 at 02:17 -0800, Ryan Ingram wrote: 2008/12/31 Paolino paolo.verone...@gmail.com: I must ask why runWriterT k :: State s (a,[Int]) is working. Looks like I could runIO the same way I evalState there. In that case I wouldn't wait for the State s action to finish. Thanks

Re: [Haskell-cafe] [ANN] Haskell web server + wiki: salvia-0.0.4 + orchid-0.0.6

2009-01-01 Thread Gwern Branwen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On Thu, Jan 1, 2009 at 1:39 PM, Sebastiaan Visser wrote: On Jan 1, 2009, at 7:15 PM, Gwern Branwen wrote: On Thu, Jan 1, 2009 at 9:04 AM, Sebastiaan Visser wrote: Happy new year, you all! I'm pleased to announce three new packages on

Re: [Haskell-cafe] WriterT [w] IO is not lazy in reading [w]

2009-01-01 Thread David Menendez
On Thu, Jan 1, 2009 at 5:17 AM, Ryan Ingram ryani.s...@gmail.com wrote: It might be possible to build a lazy-ify monad transformer which would make this work. In particular, I think Oleg's LogicT transformer[1] does something of the sort, only applying side effects where they are required in

[Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Brian Hurt
First off, let me apologize for this ongoing series of stupid newbie questions. Haskell just recently went from that theoretically interesting language I really need to learn some day to a language I actually kinda understand and can write real code in (thanks to Real World Haskell). Of

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Stephan Friedrichs
Hello Brian, Brian Hurt wrote: [...] So today's question is: why isn't there a Strict monad? Something like: data Strict a = X a instance Monad Strict where ( = ) (X m) f = let x = f m in x `seq` (X x) return a = a `seq` (X a) unless I am mistaken, this violates the first

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Luke Palmer
On Thu, Jan 1, 2009 at 12:25 PM, Brian Hurt bh...@spnz.org wrote: First off, let me apologize for this ongoing series of stupid newbie questions. Haskell just recently went from that theoretically interesting language I really need to learn some day to a language I actually kinda understand

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Jonathan Cast
On Thu, 2009-01-01 at 14:25 -0500, Brian Hurt wrote: First off, let me apologize for this ongoing series of stupid newbie questions. Haskell just recently went from that theoretically interesting language I really need to learn some day to a language I actually kinda understand and can

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread David Menendez
2009/1/1 Luke Palmer lrpal...@gmail.com: So that's the answer: there already is a Strict monad. And an attempt to make a lazier one strict just results in breaking the monad laws. There is at least one transformer that will make a strict monad out of a non-strict monad. newtype CPS m a = CPS

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Luke Palmer
On Thu, Jan 1, 2009 at 1:31 PM, David Menendez d...@zednenem.com wrote: 2009/1/1 Luke Palmer lrpal...@gmail.com: So that's the answer: there already is a Strict monad. And an attempt to make a lazier one strict just results in breaking the monad laws. There is at least one transformer

Re: [Haskell-cafe] [ANN] Haskell web server + wiki: salvia-0.0.4 + orchid-0.0.6

2009-01-01 Thread Judah Jacobson
On Thu, Jan 1, 2009 at 10:39 AM, Sebastiaan Visser sfvis...@cs.uu.nl wrote: On Jan 1, 2009, at 7:15 PM, Gwern Branwen wrote: On Thu, Jan 1, 2009 at 9:04 AM, Sebastiaan Visser wrote: Happy new year, you all! I'm pleased to announce three new packages on Hackage: ... Miscellaneous

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread David Menendez
On Thu, Jan 1, 2009 at 3:44 PM, Luke Palmer lrpal...@gmail.com wrote: On Thu, Jan 1, 2009 at 1:31 PM, David Menendez d...@zednenem.com wrote: newtype CPS m a = CPS { unCPS :: forall b. (a - m b) - m b } I have heard this called the codensity monad (and it appears under that name in

[Haskell-cafe] [HUMOR] Haskell koans

2009-01-01 Thread Gwern Branwen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 In the spirit of my previous email on haikus (which turned out fairly well), I'd like to issue a RFK (Request For Koans) to everyone! You can find what I've accumulated already on http://haskell.org/haskellwiki/Koans . There are a few there, but

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Jonathan Cast
On Thu, 2009-01-01 at 13:44 -0700, Luke Palmer wrote: On Thu, Jan 1, 2009 at 1:31 PM, David Menendez d...@zednenem.com wrote: 2009/1/1 Luke Palmer lrpal...@gmail.com: So that's the answer: there already is a Strict monad. And an attempt to make a

[Haskell-cafe] unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Henning Thielemann
I think I have a very similar problem to the currently discussed WriterT [w] IO is not lazy in reading [w]. I want to defer IO actions, until they are needed, but they shall be executed in order. If I call unsafeInterleaveIO, they can be executed in any order. I understand that hGetContents does

Re: [Haskell-cafe] [HUMOR] Haskell koans

2009-01-01 Thread Luke Palmer
Very nice! I'd love to see more of these. :-) On Thu, Jan 1, 2009 at 2:27 PM, Gwern Branwen gwe...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 In the spirit of my previous email on haikus (which turned out fairly well), I'd like to issue a RFK (Request For Koans) to

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Luke Palmer
On Thu, Jan 1, 2009 at 2:30 PM, Jonathan Cast jonathancc...@fastmail.fmwrote: On Thu, 2009-01-01 at 13:44 -0700, Luke Palmer wrote: On Thu, Jan 1, 2009 at 1:31 PM, David Menendez d...@zednenem.com wrote: 2009/1/1 Luke Palmer lrpal...@gmail.com: So that's the

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread David Menendez
On Thu, Jan 1, 2009 at 4:30 PM, Jonathan Cast jonathancc...@fastmail.fm wrote: On Thu, 2009-01-01 at 13:44 -0700, Luke Palmer wrote: In my reply I missed the important consideration of the strictness of (=), irrsepective of the values. While you can not force values to be strict in a monad

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Jonathan Cast
On Thu, 2009-01-01 at 17:03 -0500, David Menendez wrote: On Thu, Jan 1, 2009 at 4:30 PM, Jonathan Cast jonathancc...@fastmail.fm wrote: On Thu, 2009-01-01 at 13:44 -0700, Luke Palmer wrote: In my reply I missed the important consideration of the strictness of (=), irrsepective of the

Re: [Haskell-cafe] [ANN] Haskell web server + wiki: salvia-0.0.4 + orchid-0.0.6

2009-01-01 Thread Henning Thielemann
Judah Jacobson schrieb: On Thu, Jan 1, 2009 at 10:39 AM, Sebastiaan Visser sfvis...@cs.uu.nl wrote: On Jan 1, 2009, at 7:15 PM, Gwern Branwen wrote: On Thu, Jan 1, 2009 at 9:04 AM, Sebastiaan Visser wrote: Happy new year, you all! I'm pleased to announce three new packages on Hackage: ...

Re: [Haskell-cafe] [ANN] Haskell web server + wiki: salvia-0.0.4 + orchid-0.0.6

2009-01-01 Thread Henning Thielemann
Sebastiaan Visser schrieb: Happy new year, you all! I'm pleased to announce three new packages on Hackage: * salvia-0.0.4: A lightweight modular web server framework. Is it based on Simon Marlow's HWS, like mohws on Hackage? Does it support HTTPS?

[Haskell-cafe] The Psychology of Computer Programming

2009-01-01 Thread Achim Schneider
http://books.google.com/books?id=tiMPCAAJhl=de (by Gerald M. Weinberg) I suggest you procure a copy and read it for a) the lulz (a lot of them) b) insight into your own hack mode c) insight into how to hack recruiting and team lead d) ways to make Haskell even more subversive -- (c) this

Re: [Haskell-cafe] Re: Updating doubly linked lists

2009-01-01 Thread S. Günther
Whether circular or not, sharing values by using a back pointer is problematic for any update. Why not use a zipper instead? I looked into zippers before and the problem I had was that they never really matched the structure which I needed and which led me to think about this whole knot tying

Re: [Haskell-cafe] unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Brandon S. Allbery KF8NH
On 2009 Jan 1, at 16:44, Henning Thielemann wrote: If it is generally possible to use unsafeInterleaveIO such that it executes actions in the right order, wouldn't this allow the definition of a general lazy IO monad? I thought unsafeInterleaveIO and users of it (readFile, hGetContents)

Re: [Haskell-cafe] Re: Updating doubly linked lists

2009-01-01 Thread Derek Elkins
On Fri, 2009-01-02 at 10:48 +1100, S. Günther wrote: Whether circular or not, sharing values by using a back pointer is problematic for any update. Why not use a zipper instead? I looked into zippers before and the problem I had was that they never really matched the structure which I needed

[Haskell-cafe] Thoughts on Haskell and OOP

2009-01-01 Thread Kevin Van Horn
Haskell has been around in one form or another for nearly two decades now, yet has never been extended with explicit support for object- oriented programming. I've been thinking about why this is so. I've come to the conclusion that Haskell simply doesn't need any explicit OOP support --

[Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Achim Schneider
Henning Thielemann schlepp...@henning-thielemann.de wrote: If it is generally possible to use unsafeInterleaveIO such that it executes actions in the right order, wouldn't this allow the definition of a general lazy IO monad? The question is what right order means. Let B1..Bn be some

Re: [Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Henning Thielemann
On Fri, 2 Jan 2009, Achim Schneider wrote: Henning Thielemann schlepp...@henning-thielemann.de wrote: If it is generally possible to use unsafeInterleaveIO such that it executes actions in the right order, wouldn't this allow the definition of a general lazy IO monad? The question is what

Re: [Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread David Menendez
On Thu, Jan 1, 2009 at 7:39 PM, Achim Schneider bars...@web.de wrote: There are no lazy monads. Monads imply explicit sequencing... Huh? How are you defining lazy monad? -- Dave Menendez d...@zednenem.com http://www.eyrie.org/~zednenem/ ___

Re: [Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread roconnor
On Fri, 2 Jan 2009, Achim Schneider wrote: There are no lazy monads. Monads imply explicit sequencing... writing I think this is an extremely bad thing to say and is a source of misunderstanding about monads and evaluation. Most monads _are_ lazy, and it is important to understand that

[Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Achim Schneider
Henning Thielemann lemm...@henning-thielemann.de wrote: On Fri, 2 Jan 2009, Achim Schneider wrote: Henning Thielemann schlepp...@henning-thielemann.de wrote: If it is generally possible to use unsafeInterleaveIO such that it executes actions in the right order, wouldn't this allow

Re: [Haskell-cafe] Thoughts on Haskell and OOP

2009-01-01 Thread Brandon S. Allbery KF8NH
On 2009 Jan 1, at 19:28, Kevin Van Horn wrote: Haskell has been around in one form or another for nearly two decades now, yet has never been extended with explicit support for object-oriented programming. I've http://homepages.cwi.nl/~ralf/OOHaskell/

Re: [Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Brandon S. Allbery KF8NH
On 2009 Jan 1, at 20:08, David Menendez wrote: On Thu, Jan 1, 2009 at 7:39 PM, Achim Schneider bars...@web.de wrote: There are no lazy monads. Monads imply explicit sequencing... Huh? How are you defining lazy monad? We've had this discussion before; somewhere in the archives is an

[Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Achim Schneider
Achim Schneider bars...@web.de wrote: [...] actually, even better: main = do acts - unsafeInterleaveIO getActs putStrLn dumdidum sequence_ acts , which, at least on my machine, prints dumdidum before asking for foo. -- (c) this sig last receiving data processing entity. Inspect

[Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Achim Schneider
Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote: On 2009 Jan 1, at 20:08, David Menendez wrote: On Thu, Jan 1, 2009 at 7:39 PM, Achim Schneider bars...@web.de wrote: There are no lazy monads. Monads imply explicit sequencing... Huh? How are you defining lazy monad? We've had

Re: [Haskell-cafe] Thoughts on Haskell and OOP

2009-01-01 Thread Derek Elkins
On Thu, 2009-01-01 at 17:28 -0700, Kevin Van Horn wrote: Haskell has been around in one form or another for nearly two decades now, yet has never been extended with explicit support for object-oriented programming. Yes it has albeit in spun-off languages. See O'Haskell and Timber. I've

Re: [Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread David Menendez
On Thu, Jan 1, 2009 at 8:29 PM, Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote: On 2009 Jan 1, at 20:08, David Menendez wrote: On Thu, Jan 1, 2009 at 7:39 PM, Achim Schneider bars...@web.de wrote: There are no lazy monads. Monads imply explicit sequencing... Huh? How are you defining

[Haskell-cafe] Re: unsafeInterleaveIO respecting order of actions

2009-01-01 Thread Achim Schneider
David Menendez d...@zednenem.com wrote: On Thu, Jan 1, 2009 at 8:29 PM, Brandon S. Allbery KF8NH allb...@ece.cmu.edu wrote: On 2009 Jan 1, at 20:08, David Menendez wrote: On Thu, Jan 1, 2009 at 7:39 PM, Achim Schneider bars...@web.de wrote: There are no lazy monads. Monads imply

[Haskell-cafe] representation on persistent store question

2009-01-01 Thread Galchin, Vasili
Hello, Say I have several data structures that are marshalled(using Binary class) and written out linearly on persistence store. I want to calculate the offsets in bytes of these various data structures in a functional language way. What is the suggested (elegant) way ? Regards, Vasili

Re: [Haskell-cafe] Will GHC finally support epoll in 2009?

2009-01-01 Thread Bryan O'Sullivan
On Wed, Dec 31, 2008 at 11:42 AM, Levi Greenspan greenspan.l...@googlemail.com wrote: Hence my question - is it likely that GHC will support epoll in 2009? Yes. I'm working on a patch at the moment. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] representation on persistent store question

2009-01-01 Thread Antoine Latter
2009/1/1 Galchin, Vasili vigalc...@gmail.com: Say I have several data structures that are marshalled(using Binary class) and written out linearly on persistence store. I want to calculate the offsets in bytes of these various data structures in a functional language way. What is the

Re: [Haskell-cafe] representation on persistent store question

2009-01-01 Thread Galchin, Vasili
The second data structure is an array of structure .. the third set of structure are a series of bit lists ... Each array element has an offset for its corresponding bit list: [{, offset: Int64}] [[bit]] when I marshall up all this offset should be the serialized/marshalled offset of

Re: [Haskell-cafe] representation on persistent store question

2009-01-01 Thread Antoine Latter
On Jan 1, 2009 11:50pm, Galchin, Vasili vigalc...@gmail.com wrote: it is a bioinformatics standard .. . I am writing on this newsgroup in order to try to be objective to get a correct and elegant answer .. in any case I am helping on the bioinformatics code (you can see on Hackage). I am

Re: [Haskell-cafe] Thoughts on Haskell and OOP

2009-01-01 Thread Colin Paul Adams
Kevin == Kevin Van Horn ke...@ksvanhorn.com writes: Kevin What do the rest of you think? Is my analysis correct? No, because ... Kevin Properly used, OOP is all about interface inheritance, not Kevin implementation inheritance. (At least in C++, Kevin implementation

Re: [Haskell-cafe] representation on persistent store question

2009-01-01 Thread Galchin, Vasili
dude .. you rock ... let me check it out ;^) Vasili On Fri, Jan 2, 2009 at 12:24 AM, Antoine Latter aslat...@gmail.com wrote: On Jan 1, 2009 11:50pm, Galchin, Vasili vigalc...@gmail.com wrote: it is a bioinformatics standard .. . I am writing on this newsgroup in order to try to be