RE: Puzzled by GHC.Types.LiftedRep

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

RE: Puzzled by GHC.Types.LiftedRep

GHC - devs mailing list

Try this paper


The function type constructor actually has type

               (->) :: forall (r1::RuntimeRep) (r2::RuntimeRep).  TYPE r1 -> TYPE r2 -> TYPE LiftedRep


But when it appears applied to two argument, thus ((->) r1 r2 t1 t2), we print it infix (t1 -> t2).


So   (-> 'GHC.Types.LiftedRep 'GHC.Types.LiftedRep thing thing)

is the same as (thing -> thing).


I cannot explain why it is being printed in that non-infix way, but your email doesn’t give enough context to know.


I hope this helps a bit.  Where did you look for information? I’d like to add pointers that would have been helpful to you.





From: Ranjit Jhala <[hidden email]>
Sent: 24 April 2019 04:56
To: [hidden email]; Simon Peyton Jones <[hidden email]>
Subject: Puzzled by GHC.Types.LiftedRep


Hi all,


Consider the following program:



import Control.Arrow (second)

import qualified Control.Monad.Trans.Reader as R


myLocal :: (r -> r) -> R.ReaderT r m a -> R.ReaderT r m a

myLocal = undefined


foo :: (thing -> thing) -> R.ReaderT (d, thing) m a -> R.ReaderT (d, thing) m a

foo arg = myLocal (second arg)


When compiled with GHC 8.6.4, I get the odd behavior that 

at the call `second arg`, the type of `arg` is just:


   thing -> thing 


but the *input* type of `second` (after applying the 

various type  and dictionary parameters) is something 

that looks like


while the *input* type of `second` (after the various type and dictionary applications etc.) is the mysterious (to me):


  (-> 'GHC.Types.LiftedRep 'GHC.Types.LiftedRep thing thing)


Can someone explain or point me to some documentation or 

paper that describes what the above means? Specifically, 

how/why does GHC "equate" the two things above in order 

to consider the core well-formed?


Many thanks in advance!


- Ranjit.




ghc-devs mailing list
[hidden email]