[GHC] #8920: Alternative GADT syntax

GHC ghc-devs at haskell.org
Sat Mar 22 12:25:55 UTC 2014


#8920: Alternative GADT syntax
----------------------------------------------+----------------------------
       Reporter:  guest                       |             Owner:
           Type:  feature request             |            Status:  new
       Priority:  normal                      |         Milestone:  7.10.1
      Component:  Compiler (Parser)           |           Version:
       Keywords:  gadts                       |  7.8.1-rc2
   Architecture:  Unknown/Multiple            |  Operating System:
     Difficulty:  Moderate (less than a day)  |  Unknown/Multiple
     Blocked By:                              |   Type of failure:  Other
Related Tickets:                              |         Test Case:
                                              |          Blocking:
----------------------------------------------+----------------------------
 An alternative syntax for GADTs

 Instead of
 {{{
 data Term x where
     K :: Term (a -> b -> a)
     S :: Term ((a -> b -> c)  -> (a -> b) -> a -> c)
     Const :: a -> Term a
     (:@) :: Term (a -> b) -> (Term a) -> Term b
 }}}

 You can write
 {{{
 data Term x = K :: Term (a -> b -> a) | S :: Term ((a -> b -> c)  -> (a ->
 b) -> a -> c) | Const a :: Term a | (:@) (Term (a -> b)) (Term a) :: Term
 b
 }}}

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


More information about the ghc-tickets mailing list