Reputation: 16850
It looks like the quasi quoter syntax has changed to now accept 4 arguments [ link ]. Has anyone used it yet? Thanks. I just want to build something really really simple, and the examples on the web won't work now.
Thanks in advance.
Upvotes: 3
Views: 340
Reputation: 77374
Each piece of the QuasiQuoter
is just a function that takes a string (the content of the quasi-quote) and returns an appropriate value in the Q
monad. If your quasiquoter doesn't support being used in some of those contexts, just return an error, e.g.:
someQuoter = QuasiQuoter { quoteType = const $ fail "type context unsupported"
, -- etc ...
}
The fail
method calls report True
, which produces a compiler error. This is pretty much the correct behavior.
Upvotes: 3
Reputation: 30580
Basically the changes are that you can now make quasiquoters for types and declarations (in addition to expressions and patterns).
It should be fine to set the type/declaration fields to error "This quasiquoter doesn't support splicing types/declarations"
if you don't want to use them.
Upvotes: 2