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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:26:01+00:00 2026-06-15T07:26:01+00:00

The paper System F with Type Equality Coercions by Sulzmann, Chakravarty, and Peyton Jones

  • 0

The paper “System F with Type Equality Coercions” by Sulzmann, Chakravarty, and Peyton Jones illustrates the translation of Haskell’s newtype into System FC with the following example:

newtype T = MkT (T -> T)

As I understand it, barring unsafePerformIO, the only possible values of this type are MkT id and MkT undefined because of parametricity. I’m curious if there are some actual uses for this (or a similar) definition.

  • 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-15T07:26:03+00:00Added an answer on June 15, 2026 at 7:26 am

    Parametricity is about the values of types with variables. T has no variables, so parametricity does not apply. Infact, T has many inhabitants

    ap :: T -> T -> T
    ap (MkT f) t = f t
    
    idT :: T
    idT = MkT id
    
    constT :: T
    constT = MkT $ \t -> MkT $ \_ -> t
    
    axiom_sT :: T
    axiom_sT = MkT $ \f -> MkT $ \g -> MkT $ \a -> (g `ap` a) `ap` (f `ap` a)
    

    The type T is an implementation of the Untyped Lambda Calculus, a universal formal system equivalent in power to a Turing machine. The three functions above (plus ap) form the SKI calculus, an equivalent formal system.

    It is possible to encode any Haskell datatype into T. Consider the type for natural numbers

    data Nat = Zero | Succ Nat
    

    we can encode Nat into T

    church :: Nat -> T
    church Zero     = MkT $ \f -> MkT $ \x -> x
    church (Succ n) = MkT $ \f -> MkT $ \x -> f `ap` (church n)
    

    now, you are partially correct though. There is no way in Haskell to write the inverse function of this (so far as I know). Which is really a shame. Although you can write a sort of psuedo inverse with the type T -> IO Nat. Also, my understanding is the GHCs optimizer can die on recursive newtypes (someone please correct me if I am wrong about this, because I would like to go back to using them).

    Instead, the type

    data T = MkT (T -> T) | Failed String
    

    with

    ap (MkT f)    a = f a
    ap (Failed s) _ = Failed s
    

    which is the lambda calculus with exceptions, can be used in a fully invertable way.

    In conclusion, in one sense T is not a useful type at all, but in another sense it is the most useful type of all.

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

Sidebar

Related Questions

we started a paper on Haskell a few weeks ago and just received our
How can I print a System.Windows.Forms.DataGrid to paper? I'm using .NET 3.5 framwork in
I am working on a system that is recognizing paper documents using OCR engines.
Ever since I heard of type inference (in Haskell), I lived under the impression
Google File System Paper - Chunk size is one of the key design parameters.
im trying to write a paper on mac os 10 and windows xp system
Preamble I'm using git as a version control system for a paper that my
I am building a DDD system and we have all the requirements on paper
I'm implementing the system described within this paper , and I'm getting a little
as i'm reading a paper An Underdetermined Linear System for GPS By Dan Kalman

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.