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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:15:27+00:00 2026-06-17T16:15:27+00:00

Suppose a Haskell library designer decides to use UndecidableInstances for some reason. The library

  • 0

Suppose a Haskell library designer decides to use UndecidableInstances for some reason. The library compiles fine. Now suppose some program uses the library (like defines some instances of its type classes), but doesn’t use the extension. Can it happen that the compilation fails (doesn’t terminate)?

If such a scenario can happen, I’d be happy to see an example. For example, as mtl uses UndecidableInstances a lot, is it possible to write a program that depends on mtl (or any other standard library that uses the extension), doesn’t use UndecidableInstances itself, but fails to compile because of undecidability?

  • 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-17T16:15:28+00:00Added an answer on June 17, 2026 at 4:15 pm

    Great question!

    In general this is certainly possible. Consider this module:

    {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances #-}
    
    module M where
    
    class C a b | a -> b where
      f :: a -> b
    
    instance C a b => C [a] [b]
      where f = map f
    

    It compiles by itself just fine. However, if you import this module and define

    g x = x + f [x]
    

    you’ll get

    Context reduction stack overflow; size = 201
    Use -fcontext-stack=N to increase stack size to N
      C [b] b
    In the second argument of `(+)', namely `f [x]'
    In the expression: x + f [x]
    In an equation for `g': g x = x + f [x]
    

    Regarding the mtl instances, I don’t see how something like this is possible, but I also don’t have a proof that it’s not.

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

Sidebar

Related Questions

Suppose that in a Haskell program I have some data whose type is something
Suppose some Haskell file is executed with runghc Queens.hs gecode_compile Now, this fails, and
Suppose I've written a Haskell package that I'd like to release to Hackage. Suppose
Suppose I have a haskell expression like: foo (Nothing, Just a) = bar a
I try to enable foreign keys using HDBC-sqlite3 haskell library. This library uses a
Suppose I want to implement a curses/console like program in HTML/CSS/Javascript. Examples might be
Suppose that my Haskell function is given an input, which is supposed to be
I'm writing a parallel Haskell program using Strategies. It's not doing what it's supposed
I'm having an issue with a simple Haskell program. It's supposed to factor a
Suppose we have the name written in any none-latin letters - languages, like Arabic,

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.