[GHC] #14255: Type-indexed type fingerprints

GHC ghc-devs at haskell.org
Wed Sep 20 07:27:20 UTC 2017


#14255: Type-indexed type fingerprints
-------------------------------------+-------------------------------------
           Reporter:  dfeuer         |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Core           |           Version:  8.2.1
  Libraries                          |
           Keywords:  Typeable       |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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

 {{{#!hs
 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

 {{{#!hs
 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)
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14255>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list