[GHC] #14394: Inferred type for pattern synonym has redundant equality constraint
#14394: Inferred type for pattern synonym has redundant equality constraint -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple PatternSynonyms, TypeInType | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Load this file into GHCi: {{{#!hs {-# LANGUAGE GADTs #-} {-# LANGUAGE PatternSynonyms #-} module Bug where import Data.Type.Equality pattern Foo = HRefl }}} {{{ $ /opt/ghc/8.2.1/bin/ghci Bug.hs GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Ok, 1 module loaded. λ> :i Foo pattern Foo :: () => (* ~ *, b ~ a) => a :~~: b }}} Notice that the type signature for `Foo` has an entirely redundant `* ~ *` constraint. The same does not happen if `TypeInType` is enabled. {{{#!hs {-# LANGUAGE GADTs #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE TypeInType #-} module Works where import Data.Type.Equality pattern Foo = HRefl }}} {{{ λ> :i Foo pattern Foo :: forall k2 k1 (a :: k1) (b :: k2). () => (k2 ~ k1, (b :: k2) ~~ (a :: k1)) => a :~~: b }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14394> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14394: Inferred type for pattern synonym has redundant equality constraint -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Keywords: Resolution: | PatternSynonyms, TypeInType 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 Simon Peyton Jones <simonpj@…>): In [changeset:"2c2f3cea93733e0c6dd04e1d891082652dcf5ea1/ghc" 2c2f3ce/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="2c2f3cea93733e0c6dd04e1d891082652dcf5ea1" Minimise provided dictionaries in pattern synonyms Trac #14394 showed that it's possible to get redundant constraints in the inferred provided constraints of a pattern synonym. This patch removes the redundancy with mkMinimalBySCs. To do this I had to generalise the type of mkMinimalBySCs slightly. And, to reduce confusing reversal, I made it stable: it now returns its result in the same order as its input. That led to a raft of error message wibbles, mostly for the better. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14394#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14394: Inferred type for pattern synonym has redundant equality constraint -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Keywords: Resolution: fixed | PatternSynonyms, TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | patsyn/should_compile/T14394 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * testcase: => patsyn/should_compile/T14394 * status: new => closed * resolution: => fixed Comment: Ha! Indeed. Thanks. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14394#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC