[GHC] #7964: GADTs in Haskell98 style

#7964: GADTs in Haskell98 style -----------------------------+---------------------------------------------- Reporter: wvv | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.6.3 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Other | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- it would be nice if it is possible to write GADTs in Haskell98 style, like this: {{{ data Expr a = I Int :: Expr Int | B Bool :: Expr Bool | Add (Expr Int) (Expr Int) :: Expr Int | Mul (Expr Int) (Expr Int) :: Expr Int | Eq (Expr Int) (Expr Int) :: Expr Bool | Magic (Expr a) (Expr a) }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7964 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7964: GADTs in Haskell98 style -----------------------------+---------------------------------------------- Reporter: wvv | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.6.3 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Other | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by thoughtpolice): It's possible to do this already with a slightly different syntax. {{{ {-# LANGUAGE TypeFamilies, ExistentialQuantification #-} data Foo a = (a ~ Int) => FooInt a | (a ~ Char) => FooChar a }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7964#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7964: GADTs in Haskell98 style -----------------------------+---------------------------------------------- Reporter: wvv | Owner: wvv Type: feature request | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.6.3 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Other | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Changes (by wvv): * owner: => wvv Comment: Nice! But it isn't documented yet. Please add it either http://lambda.haskell.org/platform/doc/current/ghc-doc/users_guide/type- families.html http://lambda.haskell.org/platform/doc/current/ghc-doc/users_guide/data- type-extensions.html#gadt http://lambda.haskell.org/platform/doc/current/ghc-doc/users_guide/data- type-extensions.html#gadt-style -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7964#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7964: GADTs in Haskell98 style -----------------------------+---------------------------------------------- Reporter: wvv | Owner: wvv Type: feature request | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.6.3 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Other | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by goldfire): I'm a little confused here. What, exactly, isn't documented? thoughtpolice has just combined the `(~)` syntax with the old syntax... I don't see any undocumented features here. Also, I should note that, even though the definition of `Foo` above compiles without `-XGADTs`, you won't be able to pattern-match on it without enabling the extension. To my mind, it's a small infelicity that GHC accepts `Foo` without `-XGADTs`, but probably not worth doing much about. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7964#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7964: GADTs in Haskell98 style -----------------------------+---------------------------------------------- Reporter: wvv | Owner: wvv Type: feature request | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.6.3 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Other | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by wvv): Oh, I see , "7.10. Equality constraints". The main idea was to give the possibility write GADTs in H98 style (with or without `-XGADTs`). Thanks! -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7964#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7964: GADTs in Haskell98 style ---------------------------------+------------------------------------------ Reporter: wvv | Owner: wvv Type: feature request | Status: closed Priority: normal | Component: Compiler (Type checker) Version: 7.6.3 | Resolution: invalid Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Other Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by goldfire): * status: new => closed * resolution: => invalid Comment: Sounds like this is resolved then. I'll close the ticket. If I've missed something here (i.e., there still is a new feature you want), please do reopen. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7964#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC