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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:57:40+00:00 2026-06-18T16:57:40+00:00

What is the difference, at various stages of the read-compile-run pipeline, between a type

  • 0

What is the difference, at various stages of the read-compile-run pipeline, between a type declaration and a newtype declaration?

My assumption was that they compiled down to the same machine instructions, and that the only difference was when the program is typechecked, where for example

type    Name  =   String
newtype Name_ = N String

You can use a Name anywhere a String is required, but the typechecker will call you out if you use a Name_ where a String is expected, even though they encode the same information.

I’m asking the question because, if this is the case, I don’t see any reason why the following declarations shouldn’t be valid:

type    List a  =    Either () (a, List a)
newtype List_ a = L (Either () (a, List_ a))

However, the type checker accepts the second one but rejects the first. Why is that?

  • 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-18T16:57:41+00:00Added an answer on June 18, 2026 at 4:57 pm

    Luqui’s comment should be an answer. Type synonym’s in Haskell are to first approximation nothing more than macros. That is, they are expanded by the type checker into fully evaluated types. The type checker can not handle infinite types, so Haskell does not have equi-recursive types.

    newtypes provide you iso-recursive types that, in GHC, essentially compile down to equi-recursive types in the core language. Haskell is not GHC core, so you don’t have access to such types. Equi-recursive types are just a bit harder to work with both for type checkers and humans, while iso-recursive types have equivalent power.

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

Sidebar

Related Questions

I'm having a tough time understanding the difference between various methods of the com.google.gwt.core.client.Scheduler
The diff program, in its various incarnations, is reasonably good at computing the difference
Is there a list of the differences between the various versions of Rails somewhere
I'm confused about the differences and relationships between the various Microsoft ASP.NET AJAX components/libraries/toolkits
We have a number of servers running various different LAMP setups. One thing that
I'm using a DB table with various different entities. This means that I can't
What is the difference in various ways of defining a script? The ways I
I need two global variables to be accessed by multiple winforms at various stages.
I have a function which can be run in various different ways, depending on
We have an application that uses various system tray icons to communicate with users.

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.