[GHC] #15232: TypeError is reported as "redundant constraint" starting with GHC 8.2
GHC
ghc-devs at haskell.org
Tue Jun 5 20:19:43 UTC 2018
#15232: TypeError is reported as "redundant constraint" starting with GHC 8.2
-------------------------------------+-------------------------------------
Reporter: fsoikin | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.2.3
Component: Compiler | Version: 8.2.2
Keywords: | Operating System: Unknown/Multiple
CustomTypeErrors |
Architecture: | Type of failure: Incorrect
Unknown/Multiple | error/warning at compile-time
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
The following program compiles fine on GHC 8.0.2, but GHC 8.2.2 issues a
warning, complaining that `TypeError` is a redundant constraint. This
makes it very inconvenient to use `TypeError` with type classes.
{{{#!hs
{-# OPTIONS_GHC -Wredundant-constraints -Wall -Werror #-}
import GHC.TypeLits (TypeError, ErrorMessage(..))
class C a where f :: a -> a
instance {-# OVERLAPPING #-} C Int where f _ = 42
instance {-# OVERLAPPABLE #-} TypeError ( 'Text "Only Int is supported" )
=> C a where f = undefined
main :: IO ()
main = print $ f (42::Int)
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15232>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list