Concrete syntax for pattern synonym type signatures

Isaac Dupree ml at
Sun Nov 9 05:03:55 UTC 2014

On 11/04/2014 05:32 AM, Simon Peyton Jones wrote:
> The "; match-required" part is optional, and the "match-provided" part might be empty.  So P1 and P2 would look like this:
>   pattern P1 :: forall a. (; Num a) => b -> (a,b)
>   pattern P2 :: forall a. (; Num a, Ord a) => a -> a

How about marking the match-provided parts with a keyword, as so:

  pattern P2 :: (match_required Num a, match_required Ord a) => a -> a

Except with a better keyword. "if" might do in a pinch:

  pattern P2 :: forall a. (if Num a, if Ord a) => a -> a

or "pattern needed" (pattern being a keyword) or "pattern forall"

  pattern P2 :: (pattern needed Num a, pattern needed Ord a) => a -> a

More information about the ghc-devs mailing list