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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:19:01+00:00 2026-05-31T23:19:01+00:00

I have recently started diving into Haskell. Its quite interesting, but the definition of

  • 0

I have recently started diving into Haskell. Its quite interesting, but the definition of Nothing baffles me and is not sinking in. On GHCI

Prelude> :t Nothing
Nothing :: Maybe a

Shouldn’t Nothing be Just Nothing, why Maybe a?

  • 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-31T23:19:02+00:00Added an answer on May 31, 2026 at 11:19 pm

    Here is the definition of the Maybe type:

    data Maybe a = Nothing | Just a
    

    This states that for some type a, the type Maybe a has two constructors: Nothing and Just a (a being the same type variable that Maybe is applied to on the LHS).

    Hopefully it’s clear how Just "foo" has type Maybe String and Just 'c' has type Maybe Char. But what type is Nothing? Since Nothing doesn’t contain any value, its constructor doesn’t use the a type variable, and therefore there’s nothing that constrains its type to a particular form of Maybe.

    That makes it a “polymorphic constant”. Nothing can be used in a context in which any Maybe type is expected, because it works equally well in all of them. That’s why GHCi reports its type as simply Maybe a: the a is a variable which could represent any type, and which type it refers to will be determined by inference based on the context in which the Nothing value is used. But when you give Nothing by itself, there are no additional clues about its specific type, so you just see the variable.

    > :t Nothing
    Nothing :: Maybe a
    > :t (Nothing :: Maybe Int)
    (Nothing :: Maybe Int) :: Maybe Int
    > :t (Nothing :: Maybe Char)
    (Nothing :: Maybe Char) :: Maybe Char
    

    And by the way, Just Nothing :: Maybe (Maybe a); it’s a Maybe wrapped in another Maybe.

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

Sidebar

Related Questions

I have recently started working with JSF2.0 and Facelets, but have run into what
I have recently started programming in WPF and bumped into the following problem. I
I have recently started looking into MQs and I had some very basic questions,
I have recently started using R and am still getting used to its data
I have recently started learning C++, but I require a compiler. I have tried
I have recently started looking into Google Charts API for possible use within the
I have recently started exploring Maven, but I feel a bit overwhelmed of all
I have recently started using Google Webmaster Tools . I was quite surprised to
I have recently started messing round with CodeIgniter and ran into problems when doing
I have recently started moving into the world of Linux development. I wanted 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.