[GHC] #8927: Multiple case match at once

GHC ghc-devs at haskell.org
Tue Mar 25 15:29:41 UTC 2014


#8927: Multiple case match at once
-------------------------------------+-------------------------------------
        Reporter:  vxanica           |            Owner:
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.1-rc2
  (Parser)                           |         Keywords:  case, multiple
      Resolution:                    |     Architecture:  Unknown/Multiple
Operating System:  Unknown/Multiple  |       Difficulty:  Easy (less than 1
 Type of failure:  None/Unknown      |  hour)
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+-------------------------------------

Comment (by Fuuzetsu):

 What happens in the case like

 {{{
  #!div style="font-size: 120%"
    {{{#!haskell
    case x of
         Just y | Nothing -> y
    }}}
  }}}

 While I think it'd be nice to have, the utility seems limited to
 constructors without arguments.

 Would this work?

 {{{
  #!div style="font-size: 120%"
    {{{#!haskell

    data Foo = A Int | B Int | C String

    case x of
         A y | B y = "AB" ++ show y
         C y -> y
    }}}
  }}}

 and would this work?

 {{{
  #!div style="font-size: 120%"
    {{{#!haskell

    data Foo = A Int | B () | C Double

    case x of
         A y | B y | C y = show y
    }}}
  }}}

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


More information about the ghc-tickets mailing list