Skip to content

class instance lost during re-export & packaging

The package TV defines an instance OFun (in module Interface.TV.OFun, source here) for a type class FunArr in the package DeepArrow. The module Interface.TV (source here) re-exports Interface.TV.OFun in its entirety.

When I compile a test program that imports Interface.TV, under ghc-6.6, the OFun instance of !FunArr is not found. If the test module also says "import Interface.TV.OFun()", the instance is found. I get this behavior with ghc, ghc --make, and ghci.

The test program:

module Bug where

import Interface.TV.UI

-- Required to pick up the FunArr instance for OFun.  GHC bug?
import Interface.TV.OFun()

reverseT :: TV KIO (String -> String)
reverseT = tv (oTitle "reverse" defaultOut) reverse

revTwice :: TV KIO (String -> String)
revTwice = reverseT ->| reverseT

Test compile:

bash-3.2$ ghc -c Bug.hs
bash-3.2$ 

If I comment out the second import line, the problem surfaces:

ghc -c Bug.hs

Bug.hs:12:11:
    No instance for (FunArr ar (Output KIO))
      arising from use of `->|' at Bug.hs:12:11-31
    Possible fix:
      add an instance declaration for (FunArr ar (Output KIO))
    In the expression: reverseT ->| reverseT
    In the definition of `revTwice': revTwice = reverseT ->| reverseT
bash-3.2$ 

More details:

bash-3.2$ uname -a
CYGWIN_NT-5.1 Compy 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin

bash-3.2$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6

bash-3.2$ ghc -v -c Bug.hs
Glasgow Haskell Compiler, Version 6.6, for Haskell 98, compiled by GHC version 6.6
Using package config file: c:\ghc\ghc-6.6\package.conf
wired-in package base mapped to base-2.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0
wired-in package template-haskell mapped to template-haskell-2.0
Hsc static flags: -static
Created temporary directory: c:/tmp/ghc3880_0
*** Checking old interface for main:Bug:
*** Parser:
*** Renamer/typechecker:

Bug.hs:12:11:
    No instance for (FunArr ar (Output KIO))
      arising from use of `->|' at Bug.hs:12:11-31
    Possible fix:
      add an instance declaration for (FunArr ar (Output KIO))
    In the expression: reverseT ->| reverseT
    In the definition of `revTwice': revTwice = reverseT ->| reverseT
*** Deleting temp files:
Deleting: c:/tmp/ghc3880_0/ghc3880_0.s
Warning: deleting non-existent c:/tmp/ghc3880_0/ghc3880_0.s
*** Deleting temp dirs:
Deleting: c:/tmp/ghc3880_0
bash-3.2$ 
Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information