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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:58:12+00:00 2026-05-23T13:58:12+00:00

I have a question about Haskell polymorphism. As I’ve learned, there are two types

  • 0

I have a question about Haskell polymorphism.

As I’ve learned, there are two types of polymorphism:

  1. Parametric: where you do not specify the input type.

    Example:

     functionName :: [a] -> a
    
  2. Overloading: as imperative programming, i.e. passing different arguments to the same function.

My problem is: how does Haskell handle overloading?

  • 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-23T13:58:12+00:00Added an answer on May 23, 2026 at 1:58 pm

    Overloading in Haskell is done using type classes. For example, let’s say you want to overload a function foo that returns an Int:

    class Fooable a where
        foo :: a -> Int
    
    instance Fooable Int where
        foo = id
    
    instance Fooable Bool where
        foo _ = 42
    

    However, they are more powerful than the overloading mechanisms found in most languages. For example, you can overload on the return type:

    class Barable a where
        bar :: Int -> a
    
    instance Barable Int where
        bar x = x + 3
    
    instance Barable Bool where
        bar x = x < 10
    

    For more examples, have a look at the predefined type classes in Haskell.

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

Sidebar

Related Questions

I have a question about this question . I posted a reply there but
i have question about two different Bundle object in below methods : onSaveInstanceState(Bundle outState);
Reading Real world Haskell i found some intresting question about data types: This pattern
I'm fairly new to Haskell and have a question about pattern-matching. Here is a
I have a beginner question about dates and String in Haskell. I need to
This is a question about the use of type classes in Haskell. I get
I have a question about tuples and lists in Haskell. I know how to
I'm following a tutorial. (Real World Haskell) And I have one beginner question about
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
I have question about normalization. Suppose I have an applications dealing with songs. First

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.