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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:06:45+00:00 2026-05-26T23:06:45+00:00

A question just came up about java generics. The example code is: public interface

  • 0

A question just came up about java generics. The example code is:

public interface A < T extends A < T> > {

}  

A linked question asks about

Class Enum<E extends Enum<E>> ...

When I try to read the java documentation about these kinds of generic expressions, my eyes glaze over and it’s Greek to me.

I’m hoping that I can understand them in terms of the Haskell equivalent!

What is the equivalent (or similar) in Haskell of one or both of these examples?

  • 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-26T23:06:46+00:00Added an answer on May 26, 2026 at 11:06 pm

    This trick is used to allow the interface to refer to the concrete implementation type, for example to enforce that the type of the argument and the type of the result are the same type as the implementing class in something like this:

    public interface Num<A extends Num<A>> {
        A add(A other); 
    }
    

    This is similar to what you get for free with type classes in Haskell:

    class Num a where
        (+) :: a -> a -> a
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just came across this question about initializing local variables. Many of the answers
Just when I was about to post this question, I came up with an
This is not a question about real code, it is just for discussion. It
I have read a lot about the Java class loading process lately. Often I
I recently came across some Java code that simply put some strings into a
I was just reading about EXCEPT and INTERSECT in the MSDN Library and came
i have a question about the theory here, i'm just starting a project which
As I was looking through SO I came across a question about handling multiple
Just came across this article about NOSQL patterns (not mine). It's covers lots of
I was just answering a question about different approaches for picking the partition in

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.