StrictData and the parser
Simon Peyton Jones
simonpj at microsoft.com
Fri Jun 5 08:41:25 UTC 2015
There is some similar stuff in GHC already, to do with "!". It is both an infix operator and (in some contexts) a unary prefix to a function argument
f !x y = ...rhs...
Just possibly the same kind of stuff will help with "~"?
| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of
| Edward Z. Yang
| Sent: 05 June 2015 01:08
| To: Johan Tibell
| Cc: "ghc-devs at haskell.org"
| Subject: Re: StrictData and the parser
| Excerpts from Johan Tibell's message of 2015-06-04 16:52:30 -0700:
| > I guess we should parse it as T a (~b), just as we have unary minus
| > bind "tighter" with the following token.
| Not in all contexts.
| It is true that if you have 'data SLPair a b = SLP a ~ b' you want to
| parse 'SLP a (~b)'
| But if you have 'Maybe a ~ b' you want to parse '(Maybe a) ~ b'.
| But in GADTs, if you have
| data SLPair a b where
| SLP :: a -> ~ b -> SLPair a b
| you want a -> (~ b) -> SLPair a b
| If the twiddle is not immediately after an arrow you don't want that,
| data T a b where
| T :: a -> a ~ b -> SLPair a b
| you want T :: a -> (a ~ b) -> SLPair a b
| ghc-devs mailing list
| ghc-devs at haskell.org
More information about the ghc-devs