Skip to content

Type-indexed type fingerprints

I have the feeling that it might well be possible to reduce the size of the trusted codebase somewhat by introducing type-indexed fingerprints. Imagine

data TypeRep (a :: k) where
    TrTyCon :: {-# UNPACK #-} !FingerprintIx a -> !TyCon -> [SomeTypeRep]
            -> TypeRep (a :: k)
    TrApp   :: forall k1 k2 (a :: k1 -> k2) (b :: k1).
               {-# UNPACK #-} !FingerprintIx (a b)
            -> TypeRep (a :: k1 -> k2)
            -> TypeRep (b :: k1)
            -> TypeRep (a b)
    TrFun   :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
                      (a :: TYPE r1) (b :: TYPE r2).
               {-# UNPACK #-} !FingerprintIx (a -> b)
            -> TypeRep a
            -> TypeRep b
            -> TypeRep (a -> b)

We could have some primitive operations like

mkFunFP :: FingerPrintIx a -> FingerPrintIx b -> FingerPrintIx (a -> b)
mkAppFP :: FingerPrintIx (a -> b) -> FingerPrintIx a -> FingerPrintIx b

eq :: FingerPrintIx a -> FingerPrintIx b -> Maybe (a :~~: b)
eqE :: FingerPrintIx a -> FingerPrintIx b -> Either (a :~~: b -> c) (a :~~: b)
Trac metadata
Trac field Value
Version 8.2.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Core Libraries
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information