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 8863383
In Process

The Archive Base Latest Questions

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

Consider what follows to be my code import Data.Char import Data.List — square square

  • 0

Consider what follows to be my code

 import Data.Char
 import Data.List

-- square
square :: Int -> Int
square n = n * n

Although this square functions looks neat and clear, when I run it

ghci ./square.hs

It returns

[1 of 1] Compiling Main             ( ./LabSheet1-solns.hs, interpreted )

./LabSheet1-solns.hs:5:1:
    parse error on input `square'
Failed, modules loaded: none.

There should probably be something wrong with my interpreter.

I am running on OS X 10.8.1

$ ghci --version
The Glorious Glasgow Haskell Compilation System, version 7.4.2

Any clue?

  • 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:57:55+00:00Added an answer on June 14, 2026 at 3:57 pm

    Your import statements are indented by one space. This basically sets “one space” as the base indentation level for the file. Since your definition of square is not indented by one space, you get a syntax error.

    To fix the problem, either indent all lines by one space, or preferably don’t indent the import statements.

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

Sidebar

Related Questions

Consider the following simple code import java.util.*; public class MainTest<T extends Object1<?,?>> { List<T>
This is a follow-up questions on a previous one . Consider this code, which
Consider the following code: template <class x1, class x2 = int*> struct CoreTemplate {
Please, consider the following code. If I declare the exports field as follows: exports
Consider the following code: <div data-role=fieldcontain> <label for=name>Car</label> <select data-inline=true data-theme=b> <option value=volvo>Volvo</option> <option
Consider this trivial function: public static bool IsPositive(IComparable<int> value) { return value.CompareTo(0) > 0;
Consider this example Javascript code: a = new Array(); a['a1']='foo'; a['a2']='bar'; b = new
My code is as follows: ggplot(data=ICL1, aes(x=as.Date(AÑO_MES), y=IndICL1, group=RUN_FM, colour=RUN_FM)) + ylim(0,150)+ xlab(Periodo) +
Consider the following code: module ftwr; import std.regex; import std.stdio; import std.conv; import std.traits;
Consider the following code sample: int i1 = 'w\'; int i2 = '\w\'; int

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.