Commit b38eae12 authored by Simon Marlow's avatar Simon Marlow
Browse files

Add a test for ":show imports"

parent b7aa8a83
......@@ -54,6 +54,7 @@ test('ghci034', normal, ghci_script, ['ghci034.script'])
test('ghci035', normal, ghci_script, ['ghci035.script'])
test('ghci036', normal, ghci_script, ['ghci036.script'])
test('ghci037', req_interp, run_command, ['$MAKE -s --no-print-directory ghci037'])
test('ghci038', normal, ghci_script, ['ghci038.script'])
test('2452', normal, ghci_script, ['2452.script'])
test('T2766', normal, ghci_script, ['T2766.script'])
......
module Foo where
import Data.List
x = map
-- Tests for ":show imports" and import/:module
:show imports
import Prelude
:show imports
:!echo -- map in scope due to explicit 'import Prelude'
:t map
import Prelude ()
:show imports
:!echo -- still in scope, 'import Prelude ()' is subsumed by 'import Prelude'
:t map
:module -Prelude
:show imports
:!echo -- still in scope, implicit import of Prelude
:t map
import Prelude ()
:show imports
:!echo -- not in scope now
:t map
:module -Prelude
:show imports
:load ghci038.hs
:t x
:show imports
:!echo :m -Foo
:m -Foo
:show imports
:t x
:!echo :m +*Foo
:m +*Foo
:show imports
:t x
import Prelude
:show imports
import Data.List hiding (nub)
:show imports
import qualified Data.List as Q
:show imports
:m -Data.List
:show imports
<interactive>:1:1: Not in scope: `map'
<interactive>:1:1: Not in scope: `x'
import Prelude -- implicit
import Prelude
-- map in scope due to explicit import Prelude
map :: (a -> b) -> [a] -> [b]
import Prelude
-- still in scope, import Prelude () is subsumed by import Prelude
map :: (a -> b) -> [a] -> [b]
import Prelude -- implicit
-- still in scope, implicit import of Prelude
map :: (a -> b) -> [a] -> [b]
import Prelude ()
-- not in scope now
import Prelude -- implicit
x :: (a -> b) -> [a] -> [b]
:module +*Foo -- added automatically
:m -Foo
import Prelude -- implicit
:m +*Foo
:module +*Foo
x :: (a -> b) -> [a] -> [b]
:module +*Foo
import Prelude
:module +*Foo
import Prelude
import Data.List hiding ( nub )
:module +*Foo
import Prelude
import Data.List hiding ( nub )
import qualified Data.List as Q
:module +*Foo
import Prelude
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment