[GHC] #15456: (ImplicitParams) Allow ? in binding patterns

GHC ghc-devs at haskell.org
Mon Jul 30 00:58:31 UTC 2018


#15456: (ImplicitParams) Allow ? in binding patterns
-------------------------------------+-------------------------------------
           Reporter:  Welperooni     |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.4.3
           Keywords:                 |  Operating System:  Unknown/Multiple
  ImplicitParams                     |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This is mostly useful when dealing with ImplicitParams. Suppose "foo"
 takes an implicit parameter "?msg"
 {{{#!hs
 -- Invalid, parse error in pattern ?msg
 bar ?msg = foo
 \?msg -> foo

 -- With -XViewPatterns, same issue
 bar ( ... -> ?msg) = foo
 }}}

 Instead, you are forced to create a local let binding
 {{{#!hs
 bar msg = let ?msg = msg in foo
 \msg -> let ?msg = msg in foo

 bar ( ... -> msg) = let ?msg = msg in foo
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15456>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list