Changes between Version 7 and Version 8 of Ticket #5255

Jun 14, 2011 7:14:42 AM (6 years ago)

I'm having trouble following the details of this discussion; some examples would help.

As I understand it, what you want is to be able to write the Haskell expression

 "<foo>mumble</blah>" :: XML

and have a compile-time error saying that the string is ill-formed. Is that right.

If so, the solution is to hand, in the form of quasi-quotation (, Geoff Mainland's enhancement to Template Haskell. You say

  [xml| <foo>mumble</blah> |]

GHC runs the xml quasi-quoter (which you write, or provide in your library) and it can check the string. Moreover, the quasi-quoter monad hooks into GHC's error reporting machinery, so you can report errors just as if they came from GHC. Moreover, you can put these quasi-quotes in patterns, or types, or declarations.

This seems so easy and so natural that I'm not sure what else you might want. Maybe I am missing the point. I suppose you might not like the concrete syntax; improvements welcome. But somewhere you have to say what the parser is.


PS: Is Template Haskell really a "horrific mess"?


  • Ticket #5255 – Description

    v7 v8  
    2121is really just another syntax for quasi-quotation, and that
    2222is what should have been used explicitly instead of these
    23 unsafe domain-specific IsString instances.
     23unsafe domain-specific `IsString` instances.
    2525I propose fixing the problem in one of the following ways:
    3737the cast is applied. We might also need some way to help
    3838GHC find the cast function at the right time, beyond just
    39 having an IsString instance somewhere in scope.
     39having an `IsString` instance somewhere in scope.
    4141By submitting this bug, I am making it clear that I am opposed