[Haskell-cafe] Happy Parsers and constraints

Alan & Kim Zimmerman alan.zimm at gmail.com
Thu May 18 20:32:29 UTC 2017

Hi all

If I have a happy parser for an AST that is polymorphic, is there any way
to put constraints on the individual rules?

e.g. if I have

data Foo a = Foo String a

and a rule something like

  foo :: { (Show a) => Foo a }
  foo : otherrule    { Foo (show $1) $1 }

Because of the way the tables are constructed in happy, the Show constraint
is not attached to the point where the rule RHS is applied.

Is this simply impossible?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170518/15b5a1eb/attachment.html>

More information about the Haskell-Cafe mailing list