
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... See RdrHsSyn.splitBang. Just possibly the same kind of stuff will help with "~"? S | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of | Edward Z. Yang | Sent: 05 June 2015 01:08 | To: Johan Tibell | Cc: "ghc-devs@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, | e.g. | | data T a b where | T :: a -> a ~ b -> SLPair a b | | you want T :: a -> (a ~ b) -> SLPair a b | | Edward | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org | http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs