{-# LANGUAGE CPP, NoImplicitPrelude #-}
#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif
#if MIN_VERSION_base(4,10,0)
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
# if !(MIN_VERSION_base(4,11,0))
{-# LANGUAGE TypeInType #-}
# endif
#endif
module Type.Reflection.Compat (
#if MIN_VERSION_base(4,10,0)
module Base
, withTypeable
, pattern TypeRep
#endif
) where
#if MIN_VERSION_base(4,11,0)
import Type.Reflection as Base
#elif MIN_VERSION_base(4,10,0)
import Type.Reflection as Base hiding (withTypeable)
#endif
#if MIN_VERSION_base(4,10,0)
# if !(MIN_VERSION_base(4,11,0))
import GHC.Exts (TYPE)
import Type.Reflection (Typeable, TypeRep)
import Unsafe.Coerce (unsafeCoerce)
withTypeable :: forall (a :: k) (r :: TYPE rep). ()
=> TypeRep a -> (Typeable a => r) -> r
withTypeable rep k = unsafeCoerce k' rep
where k' :: Gift a r
k' = Gift k
newtype Gift a (r :: TYPE rep) = Gift (Typeable a => r)
# endif
# if !(MIN_VERSION_base(4,17,0))
data TypeableInstance (a :: k) where
TypeableInstance :: Typeable a => TypeableInstance a
typeableInstance :: forall a. TypeRep a -> TypeableInstance a
typeableInstance :: forall {k} (a :: k). TypeRep a -> TypeableInstance a
typeableInstance TypeRep a
rep = forall k (a :: k) r. TypeRep a -> (Typeable a => r) -> r
withTypeable TypeRep a
rep forall {k} (a :: k). Typeable a => TypeableInstance a
TypeableInstance
pattern TypeRep :: forall a. () => Typeable a => TypeRep a
pattern $bTypeRep :: forall {k} (a :: k). Typeable a => TypeRep a
$mTypeRep :: forall {r} {k} {a :: k}.
TypeRep a -> (Typeable a => r) -> ((# #) -> r) -> r
TypeRep <- (typeableInstance -> TypeableInstance)
where TypeRep = forall {k} (a :: k). Typeable a => TypeRep a
typeRep
# endif
#endif