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
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
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
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
>
Mostly, because I want to do other sorts of compile-time inspections
on the parser. Being able to generate the parser is just the easiest
part to get started with.
- jeremy
On Tue, Mar 12, 2013 at 3:36 PM, dag.odenh...@gmail.com
wrote:
> Why not the parsers package [1]? Write the parser against
On Tue, Mar 12, 2013 at 3:32 PM, Jacques Carette wrote:
> On 13-03-12 04:06 PM, Jeremy Shaw wrote:
>>> data ParserSpec a where
>>> AnyChar :: ParserSpec Char
>>> Return :: a -> ParserSpec a
>>> Join:: ParserSpec (ParserSpec a) -> ParserSpec a
>>> FMap:: (a -> b) -> Pa
Why not the parsers package [1]? Write the parser against the Parsing class
and then use trifecta or write instances for attoparsec or parsec. With
enough inlining perhaps the overhead of the class gets optimized away?
[1] http://hackage.haskell.org/package/parsers
On Tue, Mar 12, 2013 at 9:06 P
On 13-03-12 04:06 PM, 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. [...]
I would like to suggest that while it would be cool, it is
impo
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
different parsers like parsec