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

  • Home
  • SEARCH
  • 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 8621643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:51:54+00:00 2026-06-12T06:51:54+00:00

Eeek! GHCi found Skolems in my code! … Couldn’t match type `k0′ with `b’

  • 0

Eeek! GHCi found Skolems in my code!

...
Couldn't match type `k0' with `b'
  because type variable `b' would escape its scope
This (rigid, skolem) type variable is bound by
  the type signature for
    groupBy :: Ord b => (a -> b) -> Set a -> Set (b, [a])
The following variables have types that mention k0
...

What are they? What do they want with my program?
And why are they trying to escape (the ungrateful little blighters)?

  • 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-12T06:51:55+00:00Added an answer on June 12, 2026 at 6:51 am

    To start with, a “rigid” type variable in a context means a type variable bound by a quantifier outside that context, which thus can’t be unified with other type variables.

    This works a great deal like variables bound by a lambda: Given a lambda (\x -> ... ), from the “outside” you can apply it to whatever value you like, of course; but on the inside, you can’t simply decide that the value of x should be some particular value. Picking a value for x inside the lambda should sound pretty silly, but that’s what errors about “can’t match blah blah, rigid type variable, blah blah” mean.

    Note that, even without using explicit forall quantifiers, any top-level type signature has an implicit forall for each type variable mentioned.

    Of course, that’s not the error you’re getting. What an “escaped type variable” means is even sillier–it’s like having a lambda (\x -> ...) and trying to use specific values of x outside the lambda, independently of applying it to an argument. No, not applying the lambda to something and using the result value–I mean actually using the variable itself outside the scope where it’s defined.

    The reason this can happen with types (without seeming as obviously absurd as the example with a lambda) is because there are two notions of “type variables” floating around: During unification, you have “variables” representing undetermined types, which are then identified with other such variables via type inference. On the other hand, you have the quantified type variables described above which are specifically identified as ranging over possible types.

    Consider the type of the lambda expression (\x -> x). Starting from a completely undetermined type a, we see it takes one argument and narrow that to a -> b, then we see that it must return something of the same type as its argument, so we narrow it further to a -> a. But now it works for any type a you might want, so we give it a quantifier (forall a. a -> a).

    So, an escaped type variable occurs when you have a type bound by a quantifier that GHC infers should be unified with an undetermined type outside the scope of that quantifier.


    So apparently I forgot to actually explain the term “skolem type variable” here, heh. As mentioned in comments, in our case it’s essentially synonymous with “rigid type variable”, so the above still explains the idea.

    I’m not entirely sure where the term originated from, but I would guess it involves Skolem normal form and representing existential quantification in terms of universal, as is done in GHC. A skolem (or rigid) type variable is one that, within some scope, has an unknown-but-specific type for some reason–being part of a polymorphic type, coming from an existential data type, &c.

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

Sidebar

Related Questions

I have found the following JS on the web. It is a function to
I am new to Python and while unit testing some methods on my object
I’m trying to figure out how to iterate over an array of subroutine refs.
This view function: @login_required def dashboard(request): from myproject.myapp.models import UserProfile k = UserProfile.objects.get( user=request.user.pk
I'm not getting it: I have an array to manage my markers I add
Let's say I am tasked with coding some kind of an RPG. This means
Reading the Bruce Eckel book Thinking in C#, to relearn C#, since I haven'y
This is probably me being a little dim, I am setting up a UITableViewController

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.