[GHC] #3919: Or-patterns as GHC extension
GHC
ghc-devs at haskell.org
Thu Jul 14 03:03:33 UTC 2016
#3919: Or-patterns as GHC extension
-------------------------------------+-------------------------------------
Reporter: BjornEdstrom | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: ⊥
Component: Compiler | Version:
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
Regarding syntax, could it use data constructor syntax with a magic module
{{{#!hs
import GHC.OrPatterns ( (:|:) ) -- ( pattern (:|:) ) ?
f A = ...
f B = ...
f unexpected@(C{} :|: D{} :|: E{}) = pprTrace "f" (ppr unexpected)
}}}
like Edward's suggestion in
Records/OverloadedRecordFields/OverloadedLabels
{{{#!hs
import GHC.ImplicitValues( p, q, area )
}}}
----
{{{#!hs
import qualified GHC.OrPatterns as OR ( (:|:) )
f (C{} OR.:|: D{} OR.:|: E{}) = ...
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/3919#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list