GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T19:15:05Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/1145class instance lost during re-export & packaging2019-07-07T19:15:05Zconalclass instance lost during re-export & packagingThe package [TV](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TV-0.2) defines an instance OFun (in module [Interface.TV.OFun](http://darcs.haskell.org/packages/TV/doc/html/Interface-TV-OFun.html), source [here](http://darcs...The package [TV](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TV-0.2) defines an instance OFun (in module [Interface.TV.OFun](http://darcs.haskell.org/packages/TV/doc/html/Interface-TV-OFun.html), source [here](http://darcs.haskell.org/packages/TV/doc/html/src/Interface/TV/OFun.hs.html)) for a type class [FunArr](http://darcs.haskell.org/packages/DeepArrow/doc/html/Data-FunArr.html#t%3AFunArr|) in the package [DeepArrow](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DeepArrow-0.0.1). The module [Interface.TV](http://darcs.haskell.org/packages/TV/doc/html/Interface-TV.html) (source [here](http://darcs.haskell.org/packages/TV/doc/html/src/Interface/TV.hs.html)) 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$
```
<details><summary>Trac metadata</summary>
| 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 |
</details>
<!-- {"blocked_by":[],"summary":"class instance lost during re-export & packaging","status":"New","operating_system":"Unknown","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.6","keywords":[],"differentials":[],"test_case":"","architecture":"Unknown","cc":[""],"type":"Bug","description":"The package [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TV-0.2 TV] defines an instance OFun (in module [http://darcs.haskell.org/packages/TV/doc/html/Interface-TV-OFun.html Interface.TV.OFun], source [http://darcs.haskell.org/packages/TV/doc/html/src/Interface/TV/OFun.hs.html here]) for a type class [http://darcs.haskell.org/packages/DeepArrow/doc/html/Data-FunArr.html#t%3AFunArr| FunArr] in the package [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DeepArrow-0.0.1 DeepArrow]. The module [http://darcs.haskell.org/packages/TV/doc/html/Interface-TV.html Interface.TV] (source [http://darcs.haskell.org/packages/TV/doc/html/src/Interface/TV.hs.html here]) re-exports Interface.TV.OFun in its entirety.\r\n\r\nWhen 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.\r\n\r\nThe test program:\r\n{{{\r\nmodule Bug where\r\n\r\nimport Interface.TV.UI\r\n\r\n-- Required to pick up the FunArr instance for OFun. GHC bug?\r\nimport Interface.TV.OFun()\r\n\r\nreverseT :: TV KIO (String -> String)\r\nreverseT = tv (oTitle \"reverse\" defaultOut) reverse\r\n\r\nrevTwice :: TV KIO (String -> String)\r\nrevTwice = reverseT ->| reverseT\r\n}}}\r\n\r\nTest compile:\r\n{{{\r\nbash-3.2$ ghc -c Bug.hs\r\nbash-3.2$ \r\n}}}\r\nIf I comment out the second import line, the problem surfaces:\r\n{{{\r\nghc -c Bug.hs\r\n\r\nBug.hs:12:11:\r\n No instance for (FunArr ar (Output KIO))\r\n arising from use of `->|' at Bug.hs:12:11-31\r\n Possible fix:\r\n add an instance declaration for (FunArr ar (Output KIO))\r\n In the expression: reverseT ->| reverseT\r\n In the definition of `revTwice': revTwice = reverseT ->| reverseT\r\nbash-3.2$ \r\n}}}\r\n\r\nMore details:\r\n{{{\r\nbash-3.2$ uname -a\r\nCYGWIN_NT-5.1 Compy 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin\r\n\r\nbash-3.2$ ghc --version\r\nThe Glorious Glasgow Haskell Compilation System, version 6.6\r\n\r\nbash-3.2$ ghc -v -c Bug.hs\r\nGlasgow Haskell Compiler, Version 6.6, for Haskell 98, compiled by GHC version 6.6\r\nUsing package config file: c:\\ghc\\ghc-6.6\\package.conf\r\nwired-in package base mapped to base-2.0\r\nwired-in package rts mapped to rts-1.0\r\nwired-in package haskell98 mapped to haskell98-1.0\r\nwired-in package template-haskell mapped to template-haskell-2.0\r\nHsc static flags: -static\r\nCreated temporary directory: c:/tmp/ghc3880_0\r\n*** Checking old interface for main:Bug:\r\n*** Parser:\r\n*** Renamer/typechecker:\r\n\r\nBug.hs:12:11:\r\n No instance for (FunArr ar (Output KIO))\r\n arising from use of `->|' at Bug.hs:12:11-31\r\n Possible fix:\r\n add an instance declaration for (FunArr ar (Output KIO))\r\n In the expression: reverseT ->| reverseT\r\n In the definition of `revTwice': revTwice = reverseT ->| reverseT\r\n*** Deleting temp files:\r\nDeleting: c:/tmp/ghc3880_0/ghc3880_0.s\r\nWarning: deleting non-existent c:/tmp/ghc3880_0/ghc3880_0.s\r\n*** Deleting temp dirs:\r\nDeleting: c:/tmp/ghc3880_0\r\nbash-3.2$ \r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->6.6.1Ian Lynagh <igloo@earth.li>Ian Lynagh <igloo@earth.li>