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

  • Home
  • SEARCH
  • 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 7159899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:18:27+00:00 2026-05-28T13:18:27+00:00

I am guessing this is a total beginners error. I have a hs-file in

  • 0

I am guessing this is a total beginners error. I have a hs-file in it I have written

let mylist = [1,2,3]

When I run it using :load in ghci I get the following error

parse error (possibly incorrect indentation)

The statement works when I am in Prelude mode. So basically I am wondering why is this not working when loading a file, and what’s the difference between Prelude and Main?

  • 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-05-28T13:18:28+00:00Added an answer on May 28, 2026 at 1:18 pm

    In GHCi the syntax is a little different because it acts sort of like you’re in a do-block, so you have to use the let x = ... form. In a Haskell source file you can just drop the let and write:

    mylist = [1,2,3]
    

    As for the difference between Prelude and Main, the Prelude is a standard module which defines the most common Haskell types and functions, and it’s imported by default into every Haskell module.

    Main is just the default name for a module that does not have module Foo where ... at the top.

    When using GHCi with default settings, the prompt shows which modules are currently in scope. If you just started GHCi without loading a file, this will be just the Prelude, so the prompt looks like this:

    Prelude>
    

    After loading a module, the prompt changes to show the new module that was brought into scope. As mentioned previously, this will be Main if you didn’t give it a different name.

    *Main>
    

    The asterisk means that the module has been loaded in interpreted mode, which means that everything that is in scope in the module will also be in scope at the GHCi prompt, including stuff imported from other modules such as the Prelude.

    You can bring additional modules into scope by using the :m command. Notice how the prompt changes to show the additional module.

    *Main> :m + Data.List
    *Main Data.List> 
    

    For more information, type :help in GHCi or read the GHCi chapter of the GHC User’s Guide.

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

Sidebar

Related Questions

I'm guessing this is a simple problem, but I'm just learning... I have this:
I'm guessing this isn't possible, but here goes. I have two tables, and I'm
Let me preface this post with a single caution. I am a total beginner
I am guessing this is a basic error... but can't seem to figure out
Using PHP and mySQL. I have 4 total tables, AgencyInfo, TypeCodes, PrimarySta and MutualAid.
I'm guessing this is going to involve regexp or something, but I'll give it
This is kind of tricky. There is this webpage which, I am guessing, uses
I am guessing getElementById doesn't work with radio buttons when you want to get
I have the following function in my c# silverlight application to find the total
I have run into problems getting my local php and rails development environments to

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.