[Haskell-cafe] uu-parsinglib

2012-01-21 Thread Roman Cheplyaka
* S D Swierstra doai...@uu.nl [2012-01-20 16:32:00+0100] Thus far i have only happy users, and if you are having any problems please let me know. Hi Doaitse, One thing that I'm curious about is how you avoid combinatorial explosion when parsing in a breadth-first fashion. Do you somehow manage

[Haskell-cafe] Combining Regions and Iteratees

2012-01-21 Thread oleg
Regions is an automatic resource management technique that statically ensures that all allocated resources are freed and a freed resource cannot be used. Regions also promote efficiency by helping to structure the computation so that resources will be freed soon, and en masse. Therefore, regions

[Haskell-cafe] Compiling dph package with ghc-7.4.0.20111219

2012-01-21 Thread mukesh tiwari
Hello all I have installed ghc-7.4.0.20111219 and this announcementhttp://www.haskell.org/pipermail/glasgow-haskell-users/2011-December/021310.htmlsays that The release candidate accidentally includes the random, primitive, vector and dph libraries. The final release will not include them. I

[Haskell-cafe] GLFW-0.5.0.0 is released

2012-01-21 Thread Paul Liu
There is now a new GLFW package on hackage with version number 0.5.0.0. Maintainers of packages that depend on GLFW may want to update your packages since (1) GLFW-0.4.2 is mostly broken on OS X Lion (10.7); (2) there are incompatible API changes. Notable changes include (but not limited to): 1.

Re: [Haskell-cafe] Finding longest common prefixes in a list

2012-01-21 Thread Twan van Laarhoven
On 2012-01-20 23:44, Gwern Branwen wrote: On Fri, Jan 20, 2012 at 1:57 PM, Twan van Laarhoventwa...@gmail.com wrote: Here is some example code (untested): Well, you're right that it doesn't work. I tried to fix the crucial function, 'atLeastThisManyDescendants', but it's missing something

Re: [Haskell-cafe] Monad-control rant

2012-01-21 Thread Mikhail Vorozhtsov
On 01/18/2012 10:43 PM, Edward Z. Yang wrote: Excerpts from Mikhail Vorozhtsov's message of Wed Jan 18 08:47:37 -0500 2012: Well, that's the kind of language we live in. The denotation of our language always permits for bottom values, and it's not a terribly far jump from there to undefined

Re: [Haskell-cafe] Why were unfailable patterns removed and fail added to Monad?

2012-01-21 Thread Ganesh Sittampalam
On 20/01/2012 03:23, Edward Z. Yang wrote: Oh, I'm sorry! On a closer reading of your message, you're asking not only asking why 'fail' was added to Monad, but why unfailable patterns were removed. Well, from the message linked: In Haskell 1.4 g would not be in MonadZero because (a,b)

Re: [Haskell-cafe] Contributing to http-conduit

2012-01-21 Thread Michael Snoyman
Hi Myles, These sound like two solid features, and I'd be happy to merge in code to support it. Some comments below. On Sat, Jan 21, 2012 at 8:38 AM, Myles C. Maxfield myles.maxfi...@gmail.com wrote: To: Michael Snoyman, author and maintainer of http-conduit CC: haskell-cafe Hello! I am

Re: [Haskell-cafe] Compiling dph package with ghc-7.4.0.20111219

2012-01-21 Thread Brandon Allbery
On Sat, Jan 21, 2012 at 06:47, mukesh tiwari mukeshtiwari.ii...@gmail.comwrote: I have installed ghc-7.4.0.20111219 and this announcementhttp://www.haskell.org/pipermail/glasgow-haskell-users/2011-December/021310.htmlsays that The release candidate accidentally includes the random,

[Haskell-cafe] Monads, do and strictness

2012-01-21 Thread Victor S. Miller
The do notation translates do {x - a;f} into a=(\x - f) However when we're working in the IO monad the semantics we want requires that the lambda expression be strict in its argument. So is this a special case for IO? If I wanted this behavior in other monads is there a way to specify

Re: [Haskell-cafe] Compiling dph package with ghc-7.4.0.20111219

2012-01-21 Thread mukesh tiwari
Hi Brandon Thank you for reply. Could you please tell me how to install dph because cabal install is not working with ghc-7.4.0.20111219 and I have issue with ghc-7.2.1 and dph Macintosh-0026bb610428:src mukesh$ ghci -Odph -fdph-par on the commandline: Warning: -O conflicts with

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread MigMit
On 21 Jan 2012, at 21:29, Victor S. Miller wrote: The do notation translates do {x - a;f} into a=(\x - f) However when we're working in the IO monad the semantics we want requires that the lambda expression be strict in its argument. So is this a special case for IO? If I wanted

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread Roman Cheplyaka
* Victor S. Miller victorsmil...@gmail.com [2012-01-21 12:29:32-0500] The do notation translates do {x - a;f} into a=(\x - f) However when we're working in the IO monad the semantics we want requires that the lambda expression be strict in its argument. I'm not aware of any semantics

Re: [Haskell-cafe] Compiling dph package with ghc-7.4.0.20111219

2012-01-21 Thread Brandon Allbery
On Sat, Jan 21, 2012 at 12:50, mukesh tiwari mukeshtiwari.ii...@gmail.comwrote: Hi Brandon Thank you for reply. Could you please tell me how to install dph because cabal install is not working with ghc-7.4.0.20111219 and I have issue with ghc-7.2.1 and dph Sorry, but I don't know. I don't

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
As noted, IO is not strict in the value x, only in the operation that generates x. However, should you desire strictness in a generic way, it would be trivial to model a transformer monad to provide it. E.g. data StrictT m a = StrictT (m a) runStrictT :: StrictT m a - m a runStrictT (StrictT

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread Steve Horne
On 21/01/2012 17:29, Victor S. Miller wrote: The do notation translates do {x- a;f} into a=(\x - f) However when we're working in the IO monad the semantics we want requires that the lambda expression be strict in its argument. So is this a special case for IO? If I wanted this behavior

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread Roman Cheplyaka
* David Barbour dmbarb...@gmail.com [2012-01-21 10:01:00-0800] As noted, IO is not strict in the value x, only in the operation that generates x. However, should you desire strictness in a generic way, it would be trivial to model a transformer monad to provide it. Again, that wouldn't be a

Re: [Haskell-cafe] generating parens for pretty-printing code in haskell-src-exts

2012-01-21 Thread Niklas Broberg
Hi Conal, On Sun, Jan 15, 2012 at 6:45 AM, Conal Elliott co...@conal.net wrote: I'm using haskell-src-exts together with SYB for a code-rewriting project, and I'm having difficulty with parenthesization. I naïvely expected that parentheses would be absent from the abstract syntax, being

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread Steve Horne
On 21/01/2012 18:08, Steve Horne wrote: Even so, to see that strictness isn't the issue, imagine that (=) were rewritten using a unary executeActionAndExtractResult function. You could easily rewrite your lamba to contain this expression in place of x, without actually evaluating that

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
On Sat, Jan 21, 2012 at 10:08 AM, Roman Cheplyaka r...@ro-che.info wrote: * David Barbour dmbarb...@gmail.com [2012-01-21 10:01:00-0800] As noted, IO is not strict in the value x, only in the operation that generates x. However, should you desire strictness in a generic way, it would be

Re: [Haskell-cafe] generating parens for pretty-printing code in haskell-src-exts

2012-01-21 Thread Levent Erkok
Neil Mitchell's HLint (http://community.haskell.org/~ndm/hlint/) warns about extra parens in Haskell code. So, it must have code for detecting those. I wonder if you can just insert parens liberally in a first run, and then use his algorithm to remove those that are unnecessary. The two passes can

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Menendez
On Sat, Jan 21, 2012 at 1:45 PM, David Barbour dmbarb...@gmail.com wrote: On Sat, Jan 21, 2012 at 10:08 AM, Roman Cheplyaka r...@ro-che.info wrote: * David Barbour dmbarb...@gmail.com [2012-01-21 10:01:00-0800] As noted, IO is not strict in the value x, only in the operation that generates

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
On Sat, Jan 21, 2012 at 10:51 AM, David Menendez d...@zednenem.com wrote: The Eval monad has the property: return undefined = const e = e. You can't write `const e` in the Eval monad. From what I can tell, your proposed monads do not. You can't write `const e` as my proposed monad,

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread Roman Cheplyaka
* David Barbour dmbarb...@gmail.com [2012-01-21 11:02:40-0800] On Sat, Jan 21, 2012 at 10:51 AM, David Menendez d...@zednenem.com wrote: The Eval monad has the property: return undefined = const e = e. You can't write `const e` in the Eval monad. Why not? ghci runEval $ return

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
Oops, I was misreading. You have `e` here as the next monad. In any case, I think the monad identity concept messed up. The property: return x = f = f x Logically only has meaning when `=` applies to values in the domain. `undefined` is not a value in the domain. We can define monads - which

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
On Sat, Jan 21, 2012 at 11:08 AM, Roman Cheplyaka r...@ro-che.info wrote: * David Barbour dmbarb...@gmail.com [2012-01-21 11:02:40-0800] On Sat, Jan 21, 2012 at 10:51 AM, David Menendez d...@zednenem.com wrote: The Eval monad has the property: return undefined = const e = e. You

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread Roman Cheplyaka
* David Barbour dmbarb...@gmail.com [2012-01-21 11:09:43-0800] Logically only has meaning when `=` applies to values in the domain. `undefined` is not a value in the domain. We can define monads - which meet monad laws - even in strict languages. In strict languages 'undefined' is not a

Re: [Haskell-cafe] Monad-control rant

2012-01-21 Thread Edward Z. Yang
Excerpts from Mikhail Vorozhtsov's message of Sat Jan 21 09:25:07 -0500 2012: But I also believe that you can't use this as justification to stick your head in the sand, and pretend bottoms don't exist (regardless of whether or not we'rd talking about asynchronous exceptions.) The reason is

[Haskell-cafe] Fwd: Monads, do and strictness

2012-01-21 Thread David Barbour
`undefined` is not a value in any domain. It isn't a value at all. It's certainly not part of my monad language or algebra. Up to the semantic level of comparing observable and legally defined behaviors, we can have the identity law. That's sufficient for the letter of the law, even if not ideal

[Haskell-cafe] where to put general-purpose utility functions

2012-01-21 Thread Joey Hess
I'm finding a rather unusual problem as I write haskell.. Unlike every other language I've used, large portions of my haskell code are turning out to be general-purpose, reusable code. Fully 20% of the haskell code I've written for git-annex is general purpose. Now, I came out of a decade of perl

Re: [Haskell-cafe] where to put general-purpose utility functions

2012-01-21 Thread Mike Burns
On 2012-01-21 16.20.25 -0400, Joey Hess wrote: My problem now is that as I start new projects, I want to have my haskell utility functions available, and copying them around is not ideal. So, put them on hackage. But where, exactly? Instead of putting all of them in one package, how about you

Re: [Haskell-cafe] where to put general-purpose utility functions

2012-01-21 Thread Tristan Ravitch
You might find many of these on hackage in various forms already.. it might be easier to just depend on some of those libraries. On Sat, Jan 21, 2012 at 04:20:25PM -0400, Joey Hess wrote: Some quite generic monadic control functions, few of them truely unique: whenM :: Monad m = m Bool -

Re: [Haskell-cafe] uu-parsinglib

2012-01-21 Thread S D Swierstra
The there is an amb combinator which you can use to lift an ambiguous parser into one which returns a list of results. This will take care that the part after the ambiguous non-terminal is only parsed once. Like most libraries I do indeed not cache results of applying parsers at specific

Re: [Haskell-cafe] Serializing UTCTimes

2012-01-21 Thread Yitzchak Gale
Bas van Dijk wrote: What's the recommended way for serializing (with the cereal package) an UTCTime? Serialize the Day part as an Integer using toModifiedJulianDay/ModifiedJulianDay, (Note that Day is not a constructor, it's just the name of the type.) Serialize the DiffTime as a Rational, as

Re: [Haskell-cafe] where to put general-purpose utility functions

2012-01-21 Thread Simon Hengel
headMaybe :: [a] - Maybe a Is this the same as Data.Maybe.maybeToList? readMaybe :: Read a = String - Maybe a This has been added to base recently [1]. Cheers, Simon [1] https://github.com/ghc/packages-base/commit/0e1a02b96cfd03b8488e3ff4ce232466d6d5ca77

Re: [Haskell-cafe] GLFW-0.5.0.0 is released

2012-01-21 Thread Jason Dagit
On Sat, Jan 21, 2012 at 4:32 AM, Paul Liu nine...@gmail.com wrote: There is now a new GLFW package on hackage with version number 0.5.0.0. Congrats! [snip] 4. There is an outstanding bug preventing GLFW programs to be invoked from GHCi on OS X. One has to compile before running GLFW

Re: [Haskell-cafe] where to put general-purpose utility functions

2012-01-21 Thread Christoph Breitkopf
One thing I found useful when looking if a function already exists under a different name is to use Hayoo to search for the type, i.e.: http://holumbus.fh-wedel.de/hayoo/hayoo.html#0:(a%20-%3E%20Bool)%20-%3E%20%5Ba%5D%20-%3E%20(%5Ba%5D%2C%5Ba%5D) - Chris

Re: [Haskell-cafe] Serializing UTCTimes

2012-01-21 Thread Bas van Dijk
Thanks Ertugrul and Yitzchak. I failed to notice the Real and Fractional instances for DiffTime. Thanks very much for pointing me to it. I dropped the dependency on datetime and implemented your suggestions. Bas On 21 January 2012 22:29, Yitzchak Gale g...@sefer.org wrote: Bas van Dijk wrote:

Re: [Haskell-cafe] where to put general-purpose utility functions

2012-01-21 Thread Thiago Negri
There is also Hoogle, pretty equivalent I guess. http://www.haskell.org/hoogle/ Thiago. 2012/1/21 Christoph Breitkopf chbreitk...@googlemail.com: One thing I found useful when looking if a function already exists under a different name is to use Hayoo to search for the type, i.e.:

Re: [Haskell-cafe] where to put general-purpose utility functions

2012-01-21 Thread Christoph Breitkopf
On Sat, Jan 21, 2012 at 11:08 PM, Christoph Breitkopf chbreitk...@googlemail.com wrote: One thing I found useful when looking if a function already exists under a different name is to use Hayoo to search for the type, i.e.: Uh - please ignore the bogus link - I had blindly assumed that it

Re: [Haskell-cafe] Fwd: Monads, do and strictness

2012-01-21 Thread Roman Cheplyaka
* David Barbour dmbarb...@gmail.com [2012-01-21 12:18:09-0800] `undefined` is not a value in any domain. It isn't a value at all. It's certainly not part of my monad language or algebra. Up to the semantic level of comparing observable and legally defined behaviors, we can have the identity

Re: [Haskell-cafe] Fwd: Monads, do and strictness

2012-01-21 Thread David Barbour
On Sat, Jan 21, 2012 at 2:24 PM, Roman Cheplyaka r...@ro-che.info wrote: * David Barbour dmbarb...@gmail.com [2012-01-21 12:18:09-0800] `undefined` is not a value in any domain. It isn't a value at all. It's certainly not part of my monad language or algebra. Up to the semantic level of

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread Yves Parès
(StrictT op) = f = StrictT (op = \ x - x `seq` runStrictT (f x)) Are you sure? Here you evaluate the result, and not the computation itself. Wouldn't it be: (StrictT op) = f = op ` seq` StrictT (op = \x - runStrictT (f x)) ?? 2012/1/21 David Barbour dmbarb...@gmail.com On Sat, Jan 21, 2012

[Haskell-cafe] Right tree structure for complicated problem

2012-01-21 Thread Pierre Penninckx
Hello everyone, So here is what I want to achieve: I'd like a program that calculates the time needed for water to flow out of a circuit made out of tube. The rules are : - There are multiple sources of water and only one exit. - The water can only take one path from a source to the exit. - Of

Re: [Haskell-cafe] Monads, do and strictness

2012-01-21 Thread David Barbour
Evaluating the argument/result was my intention. Evaluating the computation itself might be useful in some cases, though. Regards, Dave On Sat, Jan 21, 2012 at 3:20 PM, Yves Parès yves.pa...@gmail.com wrote: (StrictT op) = f = StrictT (op = \ x - x `seq` runStrictT (f x)) Are you sure?

Re: [Haskell-cafe] Right tree structure for complicated problem

2012-01-21 Thread Twan van Laarhoven
On 2012-01-22 00:39, Pierre Penninckx wrote: So here is what I want to achieve: I'd like a program that calculates the time needed for water to flow out of a circuit made out of tube. The rules are : - There are multiple sources of water and only one exit. - The water can only take one path from

Re: [Haskell-cafe] GLFW-0.5.0.0 is released

2012-01-21 Thread Paul Liu
On Sat, Jan 21, 2012 at 2:05 PM, Jason Dagit dag...@gmail.com wrote: 4. There is an outstanding bug preventing GLFW programs to be invoked from GHCi on OS X. One has to compile before running GLFW programs. Does it still happen with -fno-ghci-sandbox?  That fixes these sort of bugs with