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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:20:41+00:00 2026-05-24T20:20:41+00:00

This is a bit esoteric, but maddening. In an answer to another question ,

  • 0

This is a bit esoteric, but maddening. In an answer to another question, I noted that in this entirely valid program

poo :: String -> a -> a
poo _ = id

qoo :: (a -> a) -> String
qoo _ = ""

roo :: String -> String
roo = qoo . poo

the type variable a is neither solved nor generalized in the process of checking roo. I’m wondering what happens in the translation to GHC’s core language, a Church-style variant of System F. Let me spell things out longhand, with explicit type lambdas /\ and type applications @.

poo :: forall a. [Char] -> a -> a
poo = /\ a -> \ s x -> id @ a

qoo :: forall a. (a -> a) -> [Char]
qoo = /\ a -> \ f -> [] @ Char

roo :: [Char] -> [Char]
roo = (.) @ [Char] @ (? -> ?) @ [Char] (qoo @ ?) (poo @ ?)

What on earth goes in the ? places? How does roo become a valid core term? Or do we really get a mysterious vacuous quantifier, despite what the type signature says?

roo :: forall a. [Char] -> [Char]
roo = /\ a -> ...

I’ve just checked that

roo :: forall . String -> String
roo = qoo . poo

goes through ok, which may or may not mean that the thing typechecks with no extra quantification.

What’s happening down there?

  • 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-24T20:20:42+00:00Added an answer on May 24, 2026 at 8:20 pm

    Here’s the core generated by GHC (after adding some NOINLINE pragmas).

    qoo_rbu :: forall a_abz. (a_abz -> a_abz) -> GHC.Base.String
    [GblId, Arity=1, Caf=NoCafRefs]
    qoo_rbu = \ (@ a_abN) _ -> GHC.Types.[] @ GHC.Types.Char
    
    poo_rbs :: forall a_abA. GHC.Base.String -> a_abA -> a_abA
    [GblId, Arity=1]
    poo_rbs = \ (@ a_abP) _ -> GHC.Base.id @ a_abP
    
    roo_rbw :: GHC.Base.String -> GHC.Base.String
    [GblId]
    roo_rbw =
      GHC.Base..
        @ (GHC.Prim.Any -> GHC.Prim.Any)
        @ GHC.Base.String
        @ GHC.Base.String
        (qoo_rbu @ GHC.Prim.Any)
        (poo_rbs @ GHC.Prim.Any)
    

    It seems GHC.Prim.Any is used for the polymorphic type.

    From the docs (emphasis mine):

    The type constructor Any is type to which you can unsafely coerce any
    lifted type, and back.

    • It is lifted, and hence represented by a pointer
    • It does not claim to
      be a data type, and that’s important for the code generator, because
      the code gen may enter a data value but never enters a function value.

    It’s also used to instantiate un-constrained type variables after type
    checking.

    It makes sense to have such a type to insert in place of un-constrained types, as otherwise trivial expressions like length [] would cause an ambiguous type error.

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

Sidebar

Related Questions

Ok this question may sound a bit convoluted, or at least esoteric, but I'll
This might be a bit of an esoteric question, but I just want to
This is a bit esoteric, but there have to be a few people here
I came across this bit of vba code posted in another SO question. Is
This is a bit esoteric and it's possible this question will go unanswered until
This bit of code comes with new classes that are subclasses of UITableViewController... -
To this bit of code I pass the string kellogs special k and I
How do I change this bit of code so that I only allow pdf
I've got this bit of code working so that it toggles a show/hide and
I've just got this bit of code working in jQuery via an answer on

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.