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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:00:11+00:00 2026-06-10T22:00:11+00:00

Real World Haskell has this example: class BasicEq3 a where isEqual3 :: a ->

  • 0

Real World Haskell has this example:

class BasicEq3 a where
    isEqual3 :: a -> a -> Bool
    isEqual3 x y = not (isNotEqual3 x y)

    isNotEqual3 :: a -> a -> Bool
    isNotEqual3 x y = not (isEqual3 x y) 

instance BasicEq3 Bool

And when I run it in GHCI:

#> isEqual3 False False
out of memory

So, you have to implement at least one of the 2 methods or it will loop. And you get the flexibility of choosing which one, which is neat.

The question I have is, is there a way to get a warning or something if didn’t override enough of the defaults and the defaults form a loop? It seems strange to me that the compiler that is so crazy smart is fine with this example.

  • 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-10T22:00:14+00:00Added an answer on June 10, 2026 at 10:00 pm

    I think it’s perfectly fine for GHC to issue a warning in case of an “unbroken” cyclic dependency. There’s even a ticket along those lines: http://hackage.haskell.org/trac/ghc/ticket/6028

    Just because something is “undecidable” doesn’t mean no instance of the problem can be solved effectively. GHC (or any other Haskell compiler) already has quite a bit of the information it needs, and it’d be perfectly possible for it to issue a warning if the user is instantiating a class without “breaking” the cyclic dependency. And if the compiler gets it wrong in the rare cases as exemplified in previous posts, then the user can have a -nowarnundefinedcyclicmethods or a similar mechanism to tell GHC to be quiet. In nearly every other case, the warning will be most welcome and would add to programmer productivity; avoiding what’s almost always a silly bug.

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

Sidebar

Related Questions

While reading Real world Haskell I came up with this note: ghci> :info (+)
In chapter 15 of Real World Haskell, a type class is defined: class (Monad
According to a number of tutorials (including Real World Haskell) one can, using ghci
Reading Real World Haskell, on page 95 the author provides an example: myFoldl f
I'm going through Real world Haskell , and got to the example: -- file:
Reading Real world Haskell i found some intresting question about data types: This pattern
[This question is motivated by Chapter 9 in Real World Haskell] Here's a simple
I just recently started diving into Real World Haskell and the book provides some
I'm reading the Monads chapter in Real World Haskell (chapter 14). A function is
I'm trying to do the exercises in Real World Haskell in a TDD fashion,

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.