[ghc-steering-committee] Discussion about "Type Application in Patterns" (#126)

Joachim Breitner mail at joachim-breitner.de
Thu Aug 16 22:01:42 UTC 2018


Hi,

Am Donnerstag, den 16.08.2018, 08:46 +0000 schrieb Simon Peyton Jones
via ghc-steering-committee:
> What would be ambiguous is this and-pattern:
>         Nothing @ pat
> (i.e. with a nullary contructor as the first of p1 at p2).  But that's a
> pretty silly and-pattern so I think we could let this ambiguous case
> resolve as a pattern type application. 

nullary constructors can be synonyms!

   pattern Ascii :: String
   pattern Ascii <- (all isAscii -> True)

and now

   foo (Ascii @ ('X':rest)) = 

is now longer as silly…

>  You could I suppose write
> (Nothing)@pat to get the and-pattern.

Significant parenthesis? Ugh.

But yeah, maybe it is good enough™ to deal with this particular corner.

Cheers,
Joachim



-- 
Joachim Breitner
  mail at joachim-breitner.de
  http://www.joachim-breitner.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20180816/8acdc3c4/attachment.sig>


More information about the ghc-steering-committee mailing list