[GHC] #6001: Wrong diagnostics for instance signature mismatch
GHC
cvs-ghc at haskell.org
Thu Apr 12 11:14:20 CEST 2012
#6001: Wrong diagnostics for instance signature mismatch
-----------------------------------------------+----------------------------
Reporter: heisenbug | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.5 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Incorrect warning at compile-time | Testcase:
Blockedby: | Blocking:
Related: |
-----------------------------------------------+----------------------------
Consider:
-------------------------------------------
{-# LANGUAGE InstanceSigs, DataKinds, KindSignatures, GADTs #-}
data DayKind = Work | Rest
data Day :: DayKind -> * where
Mon :: Day Work
Sat :: Day Rest
instance Num (Day c) where
fromInteger :: Int -> Day p
fromInteger 1 = Mon
fromInteger 6 = Sat
-------------------------------------------
I get
$ ~/bin/ghci NumGADT.hs
GHCi, version 7.5.20120410: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( NumGADT.hs, interpreted )
NumGADT.hs:10:18:
Method signature does not match class; it should be
fromInteger :: forall (p :: DayKind). Int -> Day p
In the instance declaration for `Num (Day c)'
Failed, modules loaded: none.
Prelude>
It appears to me that instead of telling me the expected signature
GHCi simply echoes what I have provided. This is not really useful ;-)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6001>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list