Hi,

I have written a toy fixed-length-vector quasiquoter, so that you can write

[$vec|1,2|]

which has its type inferred as (Vec (S (S Z))) and you can write

mkVec :: Double -> Vec (S (S (S Z)))
mkVec x = [$vec|1,2,x|]

However, these above examples essentially demonstrate the entire syntax it
supports: number literals, and anti-quoted variables.

I would like to extend my quasiquoter to support Haskell's full expression
syntax, so that we can write, for example,

mkVec2 x = [$vec| if x > 5 then sin x else cos x |]

Is there a simple way to do this, i.e. using existing libraries? What I need
is a Haskell expression parser which outputs values of type
Language.Haskell.TH.Syntax.QExp, but I can't see one available in the TH
libraries, or in the haskell-src(-exts) libraries.

Thoughts?

Cheers,

Reiner
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to