-
Notifications
You must be signed in to change notification settings - Fork 723
Closed
Labels
Description
Describe the bug
Hiding functions from Prelude with import Prelude hiding ... doesn't work in cabal repl. It works fine in ghci.
To Reproduce
Steps to reproduce the behavior:
- make a dummy library package with
cabal init - add containers to build-depends
- run
cabal repl
Try hiding something from prelude:
ghci> import Prelude hiding (map)
ghci> import Data.Map
ghci> :t map
<interactive>:1:1: error: [GHC-87543]
Ambiguous occurrence ‘map’.
It could refer to
either ‘Prelude.map’,
imported from ‘Prelude’ at src/MyLib.hs:1:8-12
(and originally defined in ‘ghc-internal-9.1201.0:GHC.Internal.Base’),
or ‘Data.Map.map’,
imported from ‘Data.Map’
(and originally defined in ‘Data.Map.Internal’).
A more minimal test:
ghci> import Prelude hiding (map)
ghci> :t map
map :: (a -> b) -> [a] -> [b]
It seems hiding is ignored.
Expected behavior
function from Prelude gets hidden to avoid error when overloading it from another package.
It works in a plain ghci shell:
ghci> import Prelude hiding (map)
ghci> import Data.Map
ghci> :t map
map :: (a -> b) -> Map k a -> Map k b
System information
- linux
- cabal-3.14.1.1, ghc-9.12.1 (latest), and cabal-3.12.1.0.0 / ghc-9.4.8 (recommended)