Template Haskell: 'foo in patterns?

Simon Peyton-Jones simonpj at microsoft.com
Tue Jan 24 20:04:44 CET 2012

Well, 'n is really a splice (of a limited sort), and we don't allow splices in patterns (for good reasons).  The good reasons don't really apply to patterns that bind nothing, like in this case.

My sense is that it would make sense to include this idea as part of the overhaul of TH that is sketch at http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal

Trouble is, I am failing to make any progress on implementing the ideas there.  Help welcomed.


From: libraries-bounces at haskell.org [mailto:libraries-bounces at haskell.org] On Behalf Of Conal Elliott
Sent: 24 January 2012 05:59
To: libraries
Subject: Template Haskell: 'foo in patterns?

If I understand correctly, 'foo, of type Name, is a constant value in any given context. And yet it doesn't appear to be allowed in patterns, thus leading to awkwardly explicit use of variables and equality guards in otherwise pattern-matching code. Are there reasons not to allow 'foo in patterns?

-- Conal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20120124/391482ac/attachment.htm>

More information about the Libraries mailing list