Hi Adam,
that looks interresting. I'm totally new to TH and QuasiQuotes, though.
Can I run IO in a QuasiQuoter? I can run my own interpreter.



On Fri, Feb 22, 2013 at 7:12 PM, adam vogt <vogt.a...@gmail.com> wrote:

> On Fri, Feb 22, 2013 at 12:44 PM, Corentin Dupont
> <corentin.dup...@gmail.com> wrote:
> > Hi all,
> > I have a program able to read another program as a string, and interpret
> it
> > (using Hint).
> > I'd like to make unit tests, so I have a file "Test.hs" containing a
> serie
> > of test programs as strings.
> > However, how could I be sure that these test program are syntactically
> > valid, at compile time?
>
> Hi Corentin,
>
> You could write the test programs like:
>
> test1 :: String
> test1 = [qq| x+1 == 3 |]
>
> Where qq is a QuasiQuoter you have to define. It could try to parse
> the string with http://hackage.haskell.org/package/haskell-src-exts,
> and if that succeeds, returns the original string.
>
> --
> Adam
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to