GHCi doesn't allow the use of imported data contructors
|Reported by:||blamario||Owned by:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
There are two modules in this simplified scenario. The main module is Main.hs and contains the following three lines of code.
module Main where import Imp (D(..)) main = print D1
Module Imp contains a single data type definition:
module Imp where data D = D1 | D2 deriving Show
Now, when I compile Main everything works. GHCi doesn't complain when it loads the main module either, but it doesn't allow me to construct D on its command line. This makes no sense to me.
$ ghc --make Main.hs [1 of 2] Compiling Imp ( Imp.hs, Imp.o ) [2 of 2] Compiling Main ( Main.hs, Main.o ) Linking Main ... $ ./Main D1 $ ghci Main.hs GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Ok, modules loaded: Main, Imp. Prelude Main> D1 <interactive>:1:0: Not in scope: data constructor `D1' Prelude Main>