Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved ---+ Reporter: duncan| Owner: Type: bug | Status: new Priority: normal| Milestone: _|_ Component: Compiler |Version: 6.8.2 Resolution:| Keywords: Difficulty: Unknown | Os: Unknown/Multiple Testcase:| Architecture: Unknown/Multiple Failure: None/Unknown | ---+ Changes (by igloo): * milestone: 6.14.1 = _|_ Comment: The instances are now either removed, or their reason for existing is given in a comment, so 1. is done. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved ---+ Reporter: duncan| Owner: Type: bug | Status: new Priority: normal| Milestone: 6.14.1 Component: Compiler |Version: 6.8.2 Resolution:| Keywords: Difficulty: Unknown | Os: Unknown/Multiple Testcase:| Architecture: Unknown/Multiple Failure: None/Unknown | ---+ Comment (by simonpj): There seem to be two things going on in this ticket. 1. Do the instances in `mtl` and `array` have to include orphan instances? We should investigate and fix or punt. 2. Some reflections on orphan instances in general. Here the discussion is inconclusive, so we should probably milestone as _|_, leaving the ticket open so that we don't lose the thoughts. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved ---+ Reporter: duncan| Owner: Type: bug | Status: new Priority: normal| Milestone: 6.14.1 Component: Compiler |Version: 6.8.2 Resolution:| Keywords: Difficulty: Unknown | Os: Unknown/Multiple Testcase:| Architecture: Unknown/Multiple Failure: None/Unknown | ---+ Changes (by igloo): * failure: = None/Unknown * milestone: 6.12.1 = 6.14.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved -+-- Reporter: duncan|Owner: Type: bug | Status: new Priority: normal|Milestone: 6.12.1 Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by igloo): * milestone: 6.12 branch = 6.12.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved -+-- Reporter: duncan|Owner: Type: bug | Status: new Priority: normal|Milestone: 6.12 branch Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by igloo): Replying to [comment:8 simonpj]: Indeed, your code is legitimate, and that's why warnings are just warnings! More concretely, what would you like? A special kind of warning that (uniquely) does not make -Werror abort the compilation? That seems a bit irregular... But perhaps you have something in mind. Perhaps we should have separate control for two different classes of orphan warnings: * those where the class and all the types are in other packages (and thus you may not be able to easily avoid the instance, e.g. if everything is in the base package). * the rest -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved -+-- Reporter: duncan|Owner: Type: bug | Status: new Priority: normal|Milestone: 6.12 branch Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by simonpj): Indeed, your code is legitimate, and that's why warnings are just warnings! More concretely, what would you like? A special kind of warning that (uniquely) does not make -Werror abort the compilation? That seems a bit irregular... But perhaps you have something in mind. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved -+-- Reporter: duncan|Owner: Type: bug | Status: new Priority: normal|Milestone: 6.12 branch Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by Syzygies): Reflecting further, I noticed that these manual sections go together nicely: 5.1.2. Command line options in source files 5.6.12. Orphan modules and instance declarations In particular, the phrase stands out in some circumstances, the OPTIONS_GHC pragma is the Right Thing. Moving ''-fno-warn-orphans'' from the command line to a particular orphan file is idiomatic GHC for my situation. I already have a module containing helper functions such as {{{ foldrC ∷ (Foldable d, Foldable e, Foldable f) ⇒ (c a → d (e (f a))) → (a → b → b) → b → c a → b foldrC gi h y = foldr (flip $ foldr (flip $ foldr h)) y . gi }}} for defining deep Foldable instances that go through a newtype and three layers of structure. {{{ instance Foldable ((,) a) where foldr f z (_,y) = f y z }}} can arise as one of those layers, so this is a natural place to put such orphans. Instance declarations are just as hard on the programmer as on GHC itself. For example, ''Functor ((,) a)'' is documented in Control.Monad, but importing Control.Monad doesn't expose this instance. ''Functor ((,) a)'' is not documented in Data.Foldable, but importing Data.Foldable does expose this instance. This left me perplexed as to why I could define deep Functor instances that relied on ''Functor ((,) a)'', but I couldn't write ''foldr (+) 2 (1,2)'' in ghci. I was left believing that this was some compiler magic I didn't understand, until I started using ''ghc --show- iface'', and spelunking the library source code. If I could have one wish related to instance declarations, it wouldn't have to do with these orphan warnings, but rather with better control over duplicate instance declarations. For example, I can't import Data.Foldable and at the same time try to redefine ''instance Monad ((-) a)''; there is no ''hiding'' clause that affects instances. Perhaps this is a moot point, as I have yet to find a standard library instance that has a reasonable alternative definition. One can imagine Haskell' providing missing instances anytime it can prove that there is only one possible definition. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved -+-- Reporter: duncan|Owner: Type: bug | Status: new Priority: normal|Milestone: 6.12 branch Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by ross): Replying to [comment:7 Syzygies]: It came up in my code that I needed instance Foldable ((,) a) where foldr f z (_,y) = f y z which is completely parallel to the Functor instance, but unlike the Functor instance is not provided by the standard libraries. There is no way that this instance can be anything but an orphan in my code (I shouldn't change Data.Foldable on a whim, it would make my code non-portable), so in this case I would argue that it is wrong for -Wall -Werror to abort compilation over this. I added -fno-warn-orphans, but that is a clunky fix which now deprives me of that warning when it might be relevant. The compiler is right: the instance is an orphan, and it's right to warn about it, because orphan instances are inevitably a pain. The orphan instances of Monad and Functor for Prelude type constructors (which you noted) are a case in point; unfortunately they had to be orphans to avoid breaking compatibility with Haskell 98. The right fix in this case is to get the above instance (and one for Either, and Traversable instances for (,) and Either) into Data.Foldable and Data.Traversable. Unfortunately that won't help you until next September/October (and will give you a messy changeover then). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved -+-- Reporter: duncan|Owner: Type: bug | Status: new Priority: normal|Milestone: 6.12 branch Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by Syzygies): It came up in my code that I needed instance Foldable ((,) a) where foldr f z (_,y) = f y z which is completely parallel to the Functor instance, but unlike the Functor instance is not provided by the standard libraries. There is no way that this instance can be anything but an orphan in my code (I shouldn't change Data.Foldable on a whim, it would make my code non-portable), so in this case I would argue that it is wrong for -Wall -Werror to abort compilation over this. I added -fno-warn-orphans, but that is a clunky fix which now deprives me of that warning when it might be relevant. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved --+- Reporter: duncan| Owner: igloo Type: bug | Status: new Priority: normal| Milestone: 6.10.1 Component: Compiler |Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Architecture: Unknown Os: Unknown | --+- Changes (by igloo): * milestone: = 6.10.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved --+- Reporter: duncan| Owner: igloo Type: bug | Status: new Priority: normal| Milestone: Component: Compiler |Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Architecture: Unknown Os: Unknown | --+- Comment (by igloo): array done. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2467: orphan instance warnings are badly behaved
#2467: orphan instance warnings are badly behaved --+- Reporter: duncan| Owner: igloo Type: bug | Status: new Priority: normal| Milestone: Component: Compiler |Version: 6.8.2 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Architecture: Unknown Os: Unknown | --+- Changes (by simonpj): * owner: = igloo * difficulty: = Unknown Comment: Good suggestion. I've fixed this {{{ Mon Aug 4 17:21:29 BST 2008 [EMAIL PROTECTED] * Fix Trac #2467: decent warnings for orphan instances }}} You must pull the `array` and `mtl` libraries too, because they have orphan modules that die with `-Werror` unless you do. ToDo: Ian: look into de-orphanising those modules. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2467#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs