Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8862827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:49:20+00:00 2026-06-14T15:49:20+00:00

I have two .hs files: one contains a new type declaration, and the other

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:49:21+00:00Added an answer on June 14, 2026 at 3:49 pm
    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two files. file1 has the data like belowing containing only one column.
I have the two following text files: First one: chr10 1000 1001 DEL 2.4807
I am have two xml files.. I first get one and loop through it
I have created two JavaScript files. One file is "validators.js" and the other is
I have two .csv files containing correlation matrices exported from R. One file contains
What I have going on is two files, one file contains: Orange Apple The
I have two files one with senators who are retiring and one of complete
I have two template files: one for the form (loginFormTemplate) and one for the
Here I am trying to implement the jQuery I have two main files one
Say I have two files where there is one number per line File 1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.