[GHC] #10928: Refine pattern synonym signatures

Simon Peyton Jones simonpj at microsoft.com
Tue Oct 6 13:17:16 UTC 2015


I'm getting 501 "Internal server error" from Trac.

Simon

|  -----Original Message-----
|  From: ghc-tickets [mailto:ghc-tickets-bounces at haskell.org] On Behalf Of GHC
|  Sent: 06 October 2015 13:57
|  Cc: ghc-tickets at haskell.org
|  Subject: Re: [GHC] #10928: Refine pattern synonym signatures
|  
|  #10928: Refine pattern synonym signatures
|  -------------------------------------+----------------------------------
|  -------------------------------------+---
|          Reporter:  mpickering        |                Owner:
|              Type:  bug               |               Status:  new
|          Priority:  normal            |            Milestone:  8.0.1
|         Component:  Compiler          |              Version:  7.10.2
|        Resolution:                    |             Keywords:
|  Operating System:  Unknown/Multiple  |         Architecture:
|                                       |  Unknown/Multiple
|   Type of failure:  Other             |            Test Case:
|        Blocked By:                    |             Blocking:
|   Related Tickets:                    |  Differential Rev(s):
|  -------------------------------------+----------------------------------
|  -------------------------------------+---
|  
|  Comment (by rwbarton):
|  
|   One thing that bothers me about the current syntax is that `C1 a => C2 a
|  => T a` in general already has a meaning. It's the same thing as `(C1 a,
|   C2 a) => T a`. I don't know if this is actually valid Haskell 98 (I
|  suspect not), but GHC accepts it without any language flags.
|  
|   Just to throw out another option, long ago user "ski" on IRC suggested a
|  syntax for existentials-plus-constraints, dual to constrained polymorphic
|  values. The idea is dual to  {{{  forall a. C a => T a  }}}  which is a sort
|  of function that accepts a `C a` constraint and produces a  value, we have
|  {{{  exists a. C a *> T a  }}}  which is a sort of pair of a `C a`
|  constraint (dictionary) and a value.
|   (Mnemonic: `*` is like a pair and `>` is from `=>`. Not sure I am
|  convinced myself.)
|  
|   I'm not sure whether this applies directly to pattern synonyms since a
|  pattern is not really the same thing as a value. But, we could at least  use
|  the idea of two different bits of syntax for provided and required
|  constraints, e.g.,  {{{  pattern P :: (Eq a, Num a) => (Show a, Show b) *> b
|  -> T a  }}}  Here I am thinking of `(Eq a, Num a)` as in negative position
|  and `(Show  a, Show b)` in positive position, so tentatively using the
|  corresponding  `=>` and `*>`.
|  
|   Advantages:
|  
|   * Does not use syntax that already has another meaning (`C1 a => C2 a => T
|   a`)
|  
|   * You can write patterns with either empty required constraints or empty
|  provided constraints (`Cr a => T a`, `Cp a *> T a`) without having to add
|  an empty context
|  
|   * Not extremely verbose like Richard's verbose syntax
|  
|   Disadvantages:
|  
|   * Another funny bit of syntax to learn. But at least it appears in only
|  one context.
|  
|  --
|  Ticket URL:
|  <https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fghc.haskell
|  .org%2ftrac%2fghc%2fticket%2f10928%23comment%3a9&data=01%7c01%7csimonpj%4006
|  4d.mgd.microsoft.com%7c36aef97285934ba72df008d2ce4ded93%7c72f988bf86f141af91
|  ab2d7cd011db47%7c1&sdata=ppvz43W510K87Zo073GgRRNtUyhCv%2foAVTOKmQoFl%2b0%3d>
|  GHC
|  <https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.haskell
|  .org%2fghc%2f&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c36aef9728593
|  4ba72df008d2ce4ded93%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=uSFUfOAOr%
|  2b8rRO%2f3mfxurv7Xd%2bRrqvwcZFBYF0SZITc%3d>
|  The Glasgow Haskell Compiler
|  _______________________________________________
|  ghc-tickets mailing list
|  ghc-tickets at haskell.org
|  https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.haskell
|  .org%2fcgi-bin%2fmailman%2flistinfo%2fghc-
|  tickets&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c36aef97285934ba72d
|  f008d2ce4ded93%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=T8hBjZDRWulMjNrG
|  nrLd5TRA1cR8yEmmnuO9LfNjNG8%3d


More information about the ghc-devs mailing list