goldfirere / ghc

Mirror of ghc repository. DO NOT SUBMIT PULL REQUESTS HERE
http://www.haskell.org/ghc/
Other
25 stars 1 forks source link

Breakage from dynamic paper #48

Open goldfirere opened 8 years ago

goldfirere commented 8 years ago
{-# LANGUAGE PolyKinds, DataKinds, GADTs, TypeOperators,
             RankNTypes, MultiParamTypeClasses, ConstraintKinds #-}

module Typeable where

data (a :: k1) :~: (b :: k2) where
  Refl :: forall k (a :: k). a :~: a

{-
class EqT (t1 :: k1 -> *) (t2 :: k2 -> *) where
  eqT :: t1 a -> t2 b -> Maybe (a :~: b)

type EqT' k1 k2 (t :: forall k. k -> *) = EqT (t :: k1 -> *) (t :: k2 -> *)

class EqT1 (t :: forall k. k -> *) where
  eqT1 :: t a -> t b -> Maybe (a :~: b)
-}

class EqT (t :: forall k. k -> *) where
  eqT :: forall k1 k2 (a :: k1) (b :: k2).
        t a -> t b -> Maybe (a :~: b)

data GOrdering a b where
    GLT :: GOrdering a b
    GEQ :: GOrdering t t
    GGT :: GOrdering a b

class OrdT (t :: * -> *) where
  compareT :: t a -> t b -> GOrdering a b

-- Data.Typeable

data TypeRep (a :: k)
  -- primitive, indexed by type and kind
  -- instances for EqT and CompareT

instance EqT TypeRep
instance OrdT TypeRep
instance (Show (TypeRep a))

class Typeable (a :: k) where
   typeRep :: TypeRep a
   -- instances automatically generated for all type constructors

withTypeable :: TypeRep a -> (Typeable a => r) -> r
withTypeable = undefined

-- pattern matching
data AppResult (t :: k) where
  App ::  forall k1 k (a :: k1 -> k) (b :: k1).
          TypeRep a -> TypeRep b -> AppResult (a b)

splitApp :: TypeRep a -> Maybe (AppResult a)
splitApp = undefined

-- construction
mkTyApp :: TypeRep a -> TypeRep b -> TypeRep (a b)
mkTyApp = undefined

-- updated
showsTypeRep :: TypeRep a -> ShowS
rnfTypeRep :: TypeRep a -> ()
typeRepFingerprint :: TypeRep a -> Fingerprint

-- information about the 'head' type constructor
tyConPackage :: TypeRep a -> String
tyConModule :: TypeRep a -> String
tyConName :: TypeRep a -> String

data Fingerprint

showsTypeRep = undefined
rnfTypeRep = undefined
typeRepFingerprint = undefined
tyConPackage = undefined
tyConModule = undefined
tyConName = undefined

panic in ds_co_binds