Re: [Haskell-cafe] monadic DSL for compile-time parser generator, not possible?

2013-03-13 Thread oleg
Jeremy Shaw wrote: > It would be pretty damn cool if you could create a data type for > generically describing a monadic parser, and then use template haskell > to generate a concrete parser from that data type. That would allow > you to create your specification in a generic way and then target >

[Haskell-cafe] Open-source projects for beginning Haskell students?

2013-03-13 Thread Michel Kuhlmann
Hi Brent, I am myself a haskell-beginner. Too, trying to come to terms with Applicative and Monad. Nevertheless, I forked [1] @tomahawkin's `devsurf` library, with the aim of extending it to triangular-mesh and point-cloud manipulation library. There are lot's of things I still miss. For example:

Re: [Haskell-cafe] ANN: retry 0.1 - retry combinators for monadic actions that often fail

2013-03-13 Thread Simon Marechal
On 13/03/2013 05:14, Ozgun Ataman wrote: > In either case, there is a ceiling for the number of total retries. This is something that I might want to use in many places. Is it possible to have an infinite number of retries, instead of specifying impossibly large values ? _

Re: [Haskell-cafe] monadic DSL for compile-time parser generator, not possible?

2013-03-13 Thread Dominique Devriese
All, 2013/3/13 : > So, Code is almost applicative. Almost -- because we only have a > restricted pure: > pureR :: Lift a => a -> Code a > with a Lift constraint. Alas, this is not sufficient for realistic > parsers, because often we have to lift functions, as in the example of > parsing a

Re: [Haskell-cafe] monadic DSL for compile-time parser generator, not possible?

2013-03-13 Thread Dominique Devriese
2013/3/13 Dominique Devriese : > class ProductionRule p => LiftableProductionRule p where > epsilonL :: a -> Q Exp -> p aSource > > and associated > epsilonLS :: (Lift v, LiftableProductionRule p) => v -> p v > epsilonLS v = epsilonL v $ lift v Note that the point of providing epsilonL as pr

Re: [Haskell-cafe] Open-source projects for beginning Haskell students?

2013-03-13 Thread Ernesto Rodriguez
Dear Prof. Yorgey, Not something very big, but if someone wants to get hands on working with Parsec I started developing a library to work with motion capture (MoCap) data. I need to parse MoCap data for my bachelor's thesis [1] so I decided to do it in a way that might benefit others. On the othe

Re: [Haskell-cafe] monadic DSL for compile-time parser generator, not possible?

2013-03-13 Thread Josef Svenningsson
Jeremy, The problem you're trying to solve might seem tricky but it is in fact quite solvable. In Feldspar[1] we use monads quite frequently and generate code from them, in a similar fashion to what you're trying to do. We've written a paper about how we do it[2] that I welcome you to read. If you

[Haskell-cafe] Compiled program using OpenGL fails to trigger GPU switch on Mac, but works in GHCi

2013-03-13 Thread Jesper Särnesjö
Hi everybody, This started out on haskell-beginners, as a question about poor performance for a Haskell program using OpenGL. Thanks to a few good suggestions there, I've managed to figure out more or less what the underlying problem is, but not its cause. In short, I have two programs, one writt

[Haskell-cafe] Are there any reasons against using ~ when matching one-constructor data types?

2013-03-13 Thread Petr Pudlák
Dear Haskellers, b) A related suggestion would be the addition of an > irrefutable swap, (swap'?), defined as > "swap ~(a,b) = (b,a)", and its addition to Prelude for > the same reasons. > If I define a function that matches on a single-constructor data type, such as (,), is

Re: [Haskell-cafe] ANN: retry 0.1 - retry combinators for monadic actions that often fail

2013-03-13 Thread Ozgun Ataman
Good point - I'll put an option in for the next release. On Wednesday, March 13, 2013 at 4:32 AM, Simon Marechal wrote: > On 13/03/2013 05:14, Ozgun Ataman wrote: > > In either case, there is a ceiling for the number of total retries. > > > This is something that I might want to use in many pl

Re: [Haskell-cafe] Are there any reasons against using ~ when matching one-constructor data types?

2013-03-13 Thread Roman Cheplyaka
* Petr Pudlák [2013-03-13 16:32:45+0100] > If I define a function that matches on a single-constructor data type, such > as (,), is there any reason against using ~? Like > > f (a,b) = ... > > instead of > > f ~(a,b) = ... > > ? I've seen that not using ~ can lead to problems sometimes, bu

Re: [Haskell-cafe] Lazy object deserialization

2013-03-13 Thread Jeff Shaw
On 3/13/2013 12:15 AM, Scott Lawrence wrote: Hey all, All the object serialization/deserialization libraries I could find (pretty much just binary and cereal) seem to be strict with respect to the actual data being serialized. In particular, if I've serialized a large [Int] to a file, and I w

Re: [Haskell-cafe] Lazy object deserialization

2013-03-13 Thread Scott Lawrence
I tried it, but it still goes and reads the whole list. Looking at the `binary` package source code it seems that strict evaluation is hard-coded in a few places, presumably for performance reasons. It also seems to necessarily read the bytestring sequentially, so complex tree-like data structur

Re: [Haskell-cafe] Lazy object deserialization

2013-03-13 Thread Ben
that's too bad, i used lazy deserialization for an external sort thing i did aeons ago. http://www.haskell.org/pipermail/haskell-cafe/2007-July/029156.html that was an amusing exercise in lazy IO. these days it's probably better off doing something with pipes et al instead of unsafeInterleaveI

Re: [Haskell-cafe] Lazy object deserialization

2013-03-13 Thread Jeff Shaw
On 3/13/2013 6:14 PM, Ben wrote: that's too bad, i used lazy deserialization for an external sort thing i did aeons ago. http://www.haskell.org/pipermail/haskell-cafe/2007-July/029156.html that was an amusing exercise in lazy IO. these days it's probably better off doing something with pipes

[Haskell-cafe] Haskell Weekly News: Issue 262

2013-03-13 Thread Daniel Santa Cruz
Welcome to issue 262 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers the week of March 03 to 09, 2013. Quotes of the Week * byorgey: The box does not care whether you think it is stupid. It is box. * ksf: duh, we can'

[Haskell-cafe] Join a transformer

2013-03-13 Thread Michael Snoyman
I'm wondering if this pattern exists and has a name. We have the concept of joining a Monad: join :: Monad m => m (m a) -> ma How about joining a monad transformer? joinT :: (Monad m, MonadTrans t) => t (t m) a -> t m a I believe implementing this in terms of MonadTransControl[1] might be possi