Not in scope data constructor
haskell
Solution
module first () where
Assuming in reality the module name starts with an upper case letter, as it must, the empty export list - `()` - says the module doesn't export anything, so the things defined in `First` aren't in scope in `Second`.
Completely omit the export list to export all top-level bindings, or list the exported entities in the export list
module First (S, SetType(..)) where
(the `(..)` exports also the constructors of `SetType`, without that, only the type would be exported).
And use as
module Second where
import First
foo :: SetType
foo = S [1 .. 10]
or, to limit the imports to specific types and constructors:
module Second where
import First (S, SetType(..))
You can also indent the top level,
module Second where
import First
foo :: SetType
foo = S [1 .. 10]
but that is ugly, and one can get errors due to miscounting the indentation easily.
Problem
I have two .hs files: one contains a new type declaration, and the other uses it. first.hs: ``` module first () where type S = SetType data SetType = S[Integer] ``` second.hs: ``` module second () where import first ``` When I run second.hs, both modules first, second are loaded just fine. But, when I write `:type` S on Haskell platform, the following error appears Not in scope : data constructor 'S' Note: There are some functions in each module for sure, I'm just skipping it for brevity