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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:37:35+00:00 2026-06-11T11:37:35+00:00

Does Haskell erase types, and if so, in what ways is this similar/dissimilar to

  • 0

Does Haskell erase types, and if so, in what ways is this similar/dissimilar to the type erasure that occurs in Java?

  • 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-11T11:37:36+00:00Added an answer on June 11, 2026 at 11:37 am

    Warning: experience+inference. Consult someone who works on both compilers for The Truth.

    In the sense that type checking is done at compile time, and several complex features of the type system are reduced to much simpler language constructs, yes, but in a rather different way to Java.

    A type signature creates no runtime overhead. The Haskell compiler is good at program transformation (it has more leeway, because the running order is in many cases not specified by the programmer), and automatically inlines appropriate definitions and specialises haskell-polymorhpic (=java-generic) functions to a particular type etc, as it sees fit, if it helps. That’s a similar to Java type erasure, but more-so aspect.

    There are in essence no type casts needed in Haskell to ensure type safety, because Haskell is designed to be type-safe from the ground up. We don’t resort to turning everything into an Object, and we don’t cast them back, because a polymorphic(generic) function genuinely does work on any data type, no matter what, pointer types or unboxed integers, it just works, without trickery. So unlike Java, casting is not a feature of compiling polymorphic(generic) code. Haskell folk tend to feel that if you’re doing type casting, you said goodbye to type safety anyway.

    For a lovely example of how ensuring the code’s static type-correctness at compile time can avoid runtime overhead, there’s a newtype construct in Haskell which is a type-safe wrapper for an existing type, and it’s completely compiled away – all the construction and destruction simply doesn’t happen at runtime. The type system ensures at compile time it’s used correctly, it can’t be got at at runtime except using (type-checked) accessor functions.

    Polymorphic(generic) functions don’t have polymorphic overheads. Haskell-overloaded functions (Java-interface-instance methods) have a data overhead in the sense that there’s an implicit dictionary of functions used for what appears to be late binding to Java programmers, but is in fact, again, determined at compile time.

    Summary: yes, even more so than in Java, and no, they were never there at runtime to erase anyway.

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

Sidebar

Related Questions

It seems that Haskell does not the type of symbol as that in Racket?
Does haskell-mode or some alternative package offer something akin to the wonderful inferior-haskell-type inside
I am a Haskell newbie. I have noticed that Haskell does not support record
How does Haskell code work even without the Type declaration?
I've recently been learning Haskell, and I noticed that the String type (or [Char]
Can I somehow use inline assembly in Haskell (similar to what GCC does for
I have some Haskell code that does work correctly on an infinite list, but
Does Haskell have a library that does the same thing that OCaml's ( Format
Does Haskell have similar syntactic sugar to Python List Slices ? For instance in
Does anyone have any experience with doing this? I'm working on a Java decompiler

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.