[GHC] #12857: associate pattern synonyms with a type synonym

#12857: associate pattern synonyms with a type synonym -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I believe it would be useful to bundle pattern synonyms with type synonyms, which is currently not supported. For example, the `State` type synonym from monad transformers could profit from such bundling, as it would allow users to use `State (..)` in an import list: {{{#!hs {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ScopedTypeVariables #-} module State ( State (State, runState) ) where import Control.Monad newtype Identity a = Identity { runIdentity :: a } newtype StateT s m a = StateT { runStateT :: s -> m (s, a) } type State s a = StateT s Identity a pattern State { runState } <- ((runIdentity .) . runStateT -> runState) where State runState = StateT (Identity . runState) }}} (I would have a use for this in `haskell-src-exts-simple` package, which, similar to the above example, uses type synonyms to instantiate a type parameter a few datatypes to a fixed type.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12857 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12857: associate pattern synonyms with a type synonym -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 mpickering): I think this is a good idea. Also see #11461 for the class variant of this idea. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12857#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12857: associate pattern synonyms with a type synonym -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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): See #12767 about adding {{{#!hs pattern State :: (s -> (a, s)) -> State s a pattern State {runState} <- (S.runState -> runState) where State a = state a }}} et al to transformers. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12857#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12857: associate pattern synonyms with a type synonym -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 goldfire): I'm generally in favor of this idea. But I think this is a perfect candidate for the [https://github.com/ghc-proposals/ghc-proposals ghc- proposals] process. Please write up a proposal there (mentioning this already-created ticket), and then we can see if this has the community support necessary behind it. Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12857#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12857: associate pattern synonyms with a type synonym -------------------------------------+------------------------------------- Reporter: int-e | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 int-e): See also https://github.com/ghc-proposals/ghc-proposals/pull/28 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12857#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC