6.8 unable to derive with higher-kinded variable (6.6 could)

Mike Gunter m at ryangunter.com
Thu Apr 17 16:49:16 EDT 2008


GHC 6.8 seems unable to derive (some?) instances for data types with
higher-kinded variables.  GHC 6.6 manages these just fine.  See below.
What's the story?

thanks
-m


:~/haskell$ cat D.hs
data T w = T (w Bool) deriving (Show)
data ID x = ID x deriving (Show)
main = print (T (ID False))
:~/haskell$ ghci -ignore-dot-files -fallow-undecidable-instances D.hs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6.1, for Haskell
 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( D.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
T (ID False)
*Main> :q
Leaving GHCi.
:~/haskell$ ${GHC_682_BIN}/ghci -ignore-dot-files -fallow-undecidable-instances D.hs
GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( D.hs, interpreted )

D.hs:1:0:
    No instance for (Show (w Bool))
      arising from the 'deriving' clause of a data type declaration
                   at D.hs:1:0-48
    Possible fix: add an instance declaration for (Show (w Bool))
    When deriving the instance for (Show (T w))
Failed, modules loaded: none.
Prelude> 


More information about the Glasgow-haskell-users mailing list