From 34e78d25dbae959bcc59b54007263dc6a723e09a Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Fri, 15 Mar 2024 10:47:24 -0400 Subject: [PATCH] Draft: Make reify poly-kinded --- fast/Data/Reflection.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fast/Data/Reflection.hs b/fast/Data/Reflection.hs index 3402b45..d367300 100644 --- a/fast/Data/Reflection.hs +++ b/fast/Data/Reflection.hs @@ -11,6 +11,9 @@ {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} +#if __GLASGOW_HASKELL__ < 806 +{-# LANGUAGE TypeInType #-} +#endif #ifdef MIN_VERSION_template_haskell -- TH-subset that works with stage1 & unregisterised GHCs {-# LANGUAGE TemplateHaskellQuotes #-} @@ -161,11 +164,11 @@ class Reifies s a | s -> a where -- reified type. reflect :: proxy s -> a -newtype Magic a r = Magic (forall (s :: *). Reifies s a => Proxy s -> r) +newtype Magic a r k = Magic (forall (s :: k). Reifies s a => Proxy s -> r) -- | Reify a value at the type level, to be recovered with 'reflect'. -reify :: forall a r. a -> (forall (s :: *). Reifies s a => Proxy s -> r) -> r -reify a k = unsafeCoerce (Magic k :: Magic a r) (const a) Proxy +reify :: forall a r k. a -> (forall (s :: k). Reifies s a => Proxy s -> r) -> r +reify a k = unsafeCoerce (Magic k :: Magic a r k) (const a) Proxy {-# INLINE_UNSAFE_COERCE reify #-} instance KnownNat n => Reifies n Integer where