[GHC] #13116: Allow Overloaded things in patterns

#13116: Allow Overloaded things in patterns -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | 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: -------------------------------------+------------------------------------- This ticket is motivated by the use of `OverloadedLabels` of the [http://hackage.haskell.org/package/choice-0.2.0 choice package]. One can use a type `Choice "block"` with values `Do #block` and `Don't #block` by using `OverloadedLabels`. However, in patterns this syntax is forbidden. {{{ case block of Do #block -> ... Don't #block -> ... }}} It would be nice if overloaded labels desugared to something sensible in patterns, perhaps {{{ case block of Do ((==) (fromLabel (proxy# :: Proxy# "foo")) -> True) -> ... Don't ((==) (fromLabel (proxy# :: Proxy# "foo")) -> True) -> ... }}} `OverloadedLists` and `OverloadedStrings` could benefit from a similar solution. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13116 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13116: Allow Overloaded things in patterns -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | 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: | -------------------------------------+------------------------------------- Description changed by facundo.dominguez: @@ -18,2 +18,2 @@ - Do ((==) (fromLabel (proxy# :: Proxy# "foo")) -> True) -> ... - Don't ((==) (fromLabel (proxy# :: Proxy# "foo")) -> True) -> ... + Do ((==) (fromLabel (proxy# :: Proxy# "block")) -> True) -> ... + Don't ((==) (fromLabel (proxy# :: Proxy# "block")) -> True) -> ... New description: This ticket is motivated by the use of `OverloadedLabels` of the [http://hackage.haskell.org/package/choice-0.2.0 choice package]. One can use a type `Choice "block"` with values `Do #block` and `Don't #block` by using `OverloadedLabels`. However, in patterns this syntax is forbidden. {{{ case block of Do #block -> ... Don't #block -> ... }}} It would be nice if overloaded labels desugared to something sensible in patterns, perhaps {{{ case block of Do ((==) (fromLabel (proxy# :: Proxy# "block")) -> True) -> ... Don't ((==) (fromLabel (proxy# :: Proxy# "block")) -> True) -> ... }}} `OverloadedLists` and `OverloadedStrings` could benefit from a similar solution. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13116#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13116: Allow Overloaded things in patterns -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | OverloadedLabels OverloadedStrings | OverloadedLists Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: 11671 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by facundo.dominguez): * keywords: => OverloadedLabels OverloadedStrings OverloadedLists * related: => 11671 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13116#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13116: Allow Overloaded things in patterns -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | OverloadedLabels, | OverloadedStrings, OverloadedLists Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11671 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by mpickering): * keywords: OverloadedLabels OverloadedStrings OverloadedLists => OverloadedLabels, OverloadedStrings, OverloadedLists * related: 11671 => #11671 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13116#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13116: Allow Overloaded things in patterns -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | OverloadedLabels, | OverloadedStrings, OverloadedLists Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11671 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Iceland_jack): * cc: Iceland_jack (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13116#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13116: Allow Overloaded things in patterns -------------------------------------+------------------------------------- Reporter: | Owner: (none) facundo.dominguez | Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | OverloadedLabels, | OverloadedStrings, OverloadedLists Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11671 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by mentheta): * cc: mentheta (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13116#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13116: Allow Overloaded things in patterns -------------------------------------+------------------------------------- Reporter: | Owner: (none) facundo.dominguez | Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | OverloadedLabels, | OverloadedStrings, OverloadedLists Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11671 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata): Note that this already works for `OverloadedStrings`: {{{ $ ghci GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help Prelude> :set -XOverloadedStrings Prelude> import Data.Text Prelude Data.Text> let foo :: Text -> Text; foo "foo" = "bar" Prelude Data.Text> foo "foo" "bar" }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13116#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC