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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:42:43+00:00 2026-05-22T23:42:43+00:00

Give an ugly example: data Bighead = Big little = 1 f1 = little

  • 0

Give an ugly example:

data Bighead = Big

little = 1 

f1 = little :: Int

f2 = Big :: BigHead

In my opinion:

f1 and f2 all point to some data. the only different of (little and Big) is
little has a piece of code to do evaluation. but Big doesn’t.

They all have a rewritable body, little can be transformed from a collection of data to a result, and Big is just don’t do the last step — it always holds this data forms (but recursively they can be evaluated).

But in syntax form, they are almost the same: can be applied, can be evaluated.

One big deal may be that functions can’t alter its applied params, but data can do.

Is this the only reason that Haskell treats data and function’s names differently?

Call for analysis 🙂

edit: some more pads

data A = B Int

type of B:

B :: Int -> A

b :: Int -> A

b = B 
  • 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-22T23:42:44+00:00Added an answer on May 22, 2026 at 11:42 pm

    From the Haskell 98 Language we see the core distinction in identifier tokens in Haskell:

    varid   ->   (small {small | large | digit | ' })<reservedid>
    conid   ->   large {small | large | digit | ' }
    

    That is, the language fundamentally distinguish variable names ("varid") from constructor names ("conid"), at all levels of the language (both value and type variables and constructors). So clearly, Haskell distinguishes identifiers into two main namespaces (well, there are others, if you count modules and classes), but two primary ones, those that begin with a lower-case letter (variable identifiers) and those that begin with an upper-case letter (constructor identifiers).

    So, given that we do distinguish constructors from variables, the question is "why?".

    Reading types

    One plausible argument is that it makes it very easy to spot parameters in types (e.g. polymorphic types).

    Pattern matching

    Secondly, and more importantly, we have uniform syntax for data construction and deconstruction (pattern matching). Whenever you see an upper case identifier in a pattern,

    case x of
       Foo y z -> ...
    

    You know that Foo is a data structure being taken apart and its components named. Correspondingly, whenever you see an upper case identifier in an expression,

    g (f (Foo 1 2)
    

    you know that f is receiving a newly built Foo data type with two arguments.

    So, since constructors (both type and value) are so important in the language, this simple restriction to upper case identifiers makes it much easier for a human to see what is going on in a piece of code. In some ways upper case letters make up for the lack of other syntactic noise in the language, as an aid to the reader.


    Namespaces

    There are six kinds of names in Haskell : those for variables and constructors denote values; those for type variables, type constructors, and type classes refer to entities related to the type system; and module names refer to modules. There are two constraints on naming:

    Names for variables and type variables are identifiers beginning with lowercase letters or underscore; the other four kinds of names are identifiers beginning with uppercase letters.
    An identifier must not be used as the name of a type constructor and a class in the same scope.
    These are the only constraints; for example, Int may simultaneously be the name of a module, class, and constructor within a single scope.

    Haskell B

    In Haskell B, constructors and variables could use either case.

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

Sidebar

Related Questions

Django documents give this example of associating extra data with a M2M relationship. Although
Give me some of your thoughts on which is a better coding practice/makes more
Give a linear-time algorithm to test whether a tree has a perfect matching, that
Give that I have written a JPanel with many different components on it, is
To give an example of the kind of request that I can't figure out
In SQL Server, I have a table where a column A stores some data.
I have some ugly strings similar to these: string1 = 'Fantini, Rauch, C.Straus, Priuli,
Give an algorithm to find a given element x (give the co-ordinates), in an
Give a base class Base , I want to write a method Test, like
Give an Image component, how can I tell the size [width and height] of

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.