Bugs item #1167383, was opened at 2005-03-21 10:01 Message generated for change (Comment added) made by remit You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1167383&group_id=8032
Category: GHCi Group: None Status: Open Resolution: None Priority: 4 Submitted By: Simon Peyton Jones (simonpj) Assigned to: Nobody/Anonymous (nobody) Summary: GHCi reports too few instances Initial Comment: GHCi aspires to report all instances that can be written unqualified in the current scope; but it doesn't. | ~% ghci | ___ ___ _ | / _ \ /\ /\/ __(_) | / /_\// /_/ / / | | GHC Interactive, version 6.4, for Haskell 98. | / /_\/ __ / /___| | http://www.haskell.org/ghc/ | \____/\/ /_/\____/|_| Type :? for help. | | Loading package base-1.0 ... linking ... done. | | Prelude> :i Bool | data Bool = False | True -- <wired into compiler> | instance Eq Bool -- Imported from GHC.Base | instance Ord Bool -- Imported from GHC.Base | | Prelude> :i Bool | data Bool = False | True -- <wired into compiler> | instance Bounded Bool -- Imported from GHC.Enum | instance Enum Bool -- Imported from GHC.Enum | instance Eq Bool -- Imported from GHC.Base | instance Ord Bool -- Imported from GHC.Base | instance Read Bool -- Imported from GHC.Read | instance Show Bool -- Imported from GHC.Show ---------------------------------------------------------------------- Comment By: Remi Turk (remit) Date: 2005-03-28 18:10 Message: Logged In: YES user_id=26642 Though it's (they are) probably not strictly the same bug, I'll report them here as they're definitely related, and I suspect they'll someday be fixed all at once. ----------------- First, GHCi's :info doesn't seem to show any instances of function types. That is, instances like the following are never shown by an :info. instance Arrow (->) instance Monad ((->) r) instance Num b => Num (a -> b) instance Foo (Bar (->)) and variants are shown, however. ----------------- Second, though it's more a (very low priority) feature request than a bugreport, it would be nice if ":info (->)" and variants would work. ----------------- Then, modules first loaded, then removed again in GHCi leave their instances behind: Prelude> :module +Control.Monad.Reader Prelude Control.Monad.Reader> return 42 $ 0 Loading package mtl-1.0 ... linking ... done. 42 -- okay, instance Monad (r->) is in scope Prelude Control.Monad.Reader> :module -Control.Monad.Reader Prelude> return 42 $ 0 42 -- and stil is... Both in 6.4 and 6.2.1, at least. ----------------- Finally, just to make this bug-report a bit more complete, I'll copypaste a documented bug from http://www.haskell.org/ghc/docs/latest/html/users_guide/bugs.html#bugs-ghci, which I /think/ is not exactly the same as the previous one. "GHCi does not keep careful track of what instance declarations are 'in scope' if they come from other packages. Instead, all instance declarations that GHC has seen in other packages are all in scope everywhere, whether or not the module from that package is used by the command-line expression" ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1167383&group_id=8032 _______________________________________________ Glasgow-haskell-bugs mailing list [email protected] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
