[GHC] #4832: Inconsistent import of instances in GHCi
GHC
cvs-ghc at haskell.org
Fri Dec 10 11:43:43 CET 2010
#4832: Inconsistent import of instances in GHCi
---------------------------------+------------------------------------------
Reporter: sebf | Owner:
Type: bug | Status: new
Priority: normal | Component: GHCi
Version: 7.0.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Issuing `import M` in GHCi does not bring the same instances into scope as
issuing `:m + M` and loading a file that contains `import M` do.
For example, the module `Control.Applicative` imports
`Control.Monad.Instances` which defines a `Functor` instance for `((->)
r)`. The following GHCi session demonstrates that this instance is not in
scope after issuing an `import` command in GHCi but it is in scope after
issuing an `:m +` command. It is also in scope after loading a file that
imports `Control.Applicative`.
{{{
Prelude> fmap id id ()
<interactive>:1:1:
No instance for (Functor ((->) ()))
arising from a use of `fmap'
Possible fix: add an instance declaration for (Functor ((->) ()))
In the expression: fmap id id ()
In an equation for `it': it = fmap id id ()
Prelude> import Control.Applicative
Prelude Control.Applicative> fmap id id ()
<interactive>:1:1:
No instance for (Functor ((->) ()))
arising from a use of `fmap'
Possible fix: add an instance declaration for (Functor ((->) ()))
In the expression: fmap id id ()
In an equation for `it': it = fmap id id ()
Prelude Control.Applicative> :m + Control.Applicative
Prelude Control.Applicative> fmap id id ()
()
}}}
I expected that issuing an `import` command in GHCi has the same effect as
issuing an `:m +` command or loading a file with an `import` statement.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4832>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list