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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:50:41+00:00 2026-06-08T01:50:41+00:00

I am an absolute beginner. Going through LYAH using emacs. My current Set up:

  • 0

I am an absolute beginner. Going through LYAH using emacs.

My current Set up:

  • Ubuntu 12.04 LTS (Use Experience – beginner)
  • GNU Emacs 23 (Use Experience – beginner)
    • able to work in haskell major mode

Finding difficult to follow instructions (to bring haskell libraries) at Point 2 described here.

Also need guidance to enable Scion IDE.

Problem:

.hs code

data Maybe a = Nothing | Just a

While running the code, I get following error:

Please ignore typo error, Originally posted:

*Main> just "Haha"  

interactive>:339:1: Not in scope: `just’

This is the real error (added after Tikhon Jelvis’ comment):

*Main> Just "Haha"  
interactive>:341:1:  
    Ambiguous occurrence `Just'  
    It could refer to either `Main.Just',    
                             defined at /home/optimight/baby.hs:89:26  
                          or `Prelude.Just',  
                             imported from `Prelude' at /home/optimight/baby.hs:1:1  
                             (and originally defined in `Data.Maybe')  
  • 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-08T01:50:42+00:00Added an answer on June 8, 2026 at 1:50 am

    Your error just tells you that there are two possible versions of Just and GHCi does not know which one to pick.

    Every Haskell program implicitly imports a whole bunch of functions and data types. These form the “prelude”. One of these types is Maybe. This means that every single program already has access to a type just like the one you defined, with exactly the same names.

    You can overcome this in two ways. The best option would be to just choose different names:

    data MyMaybe a = MyJust a | MyNothing
    

    (I’m sure you can come up with better names than that though :P.)

    The other option would be to import the Prelude explicitly, hiding Maybe:

    import Prelude hiding (Maybe (..))
    

    This line at the top of your program just tells Haskell to import everything it normally imports except Maybe and all of it’s constructors (Just and Nothing).

    Now you will run into one more problem: GHCi does not know how to render a value of your Maybe type into a string to show on the prompt. You will get an error like this:

    <interactive>:1:1:
    No instance for (Show (Maybe [Char]))
      arising from a use of `print'
    Possible fix: add an instance declaration for (Show (Maybe [Char]))
    In a stmt of an interactive GHCi command: print it
    

    What you need to do is tell the compiler how a Maybe value looks as a string. Happily, this is extremely easy. In fact, it’s so easy even the computer can do it! If you define your type as:

    data Maybe a = Just a | Nothing deriving (Show)
    

    then the compiler will write a show function (which is basically toString from other languages) for you. Now your original statement (Just "Haha") should work properly.

    Also: enabling Scion is a completely different question entirely. I don’t think it’s worth bothering with it until you’ve learned more Haskell and are actually working on some sort of larger project. For now, the standard Haskell mode should be more than enough.

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

Sidebar

Related Questions

I'm an absolute beginner when it comes to using both SWIG and lua, and
I'm an absolute beginner using IDLE (Python 2.6.4) to learn the basics. I recently
I am absolute beginner to drupal. I have added a contact form (using Webform
I am an absolute beginner. Never made a classifier or anything in weka using
I'm an absolute beginner at flash so please bear with me. I'm using Adobe
I'm an absolute beginner using Joomla. I'm trying to load a module within another
Working through Jerry Lee Ford Jr.'s Powershell 2.0 for the Absolute Beginner book. There's
Absolute beginner question: I have a template file index.html that looks like this: ...
I'm almost an absolute beginner in Python, but I am asked to manage some
Hello i am an absolute beginner on cloud computing and on python. I would

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.