{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Data.Record.TH.Runtime (
dictFor
, repFromVector
, repToVector
, rnfVectorAny
, noInlineUnsafeCo
) where
import Data.Coerce (coerce)
import Data.Proxy
import Data.Vector (Vector)
import GHC.Exts (Any)
import Unsafe.Coerce (unsafeCoerce)
import qualified Data.Vector as V
import Data.Record.Generic
dictFor :: c x => Proxy c -> Proxy x -> Dict c x
dictFor :: Proxy c -> Proxy x -> Dict c x
dictFor Proxy c
_ Proxy x
_ = Dict c x
forall k (c :: k -> Constraint) (a :: k). c a => Dict c a
Dict
repFromVector :: Vector Any -> Rep I a
repFromVector :: Vector Any -> Rep I a
repFromVector = Vector Any -> Rep I a
coerce
repToVector :: Rep I a -> Vector Any
repToVector :: Rep I a -> Vector Any
repToVector = Rep I a -> Vector Any
coerce
rnfVectorAny :: Vector Any -> ()
rnfVectorAny :: Vector Any -> ()
rnfVectorAny = [Any] -> ()
rnfElems ([Any] -> ()) -> (Vector Any -> [Any]) -> Vector Any -> ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector Any -> [Any]
forall a. Vector a -> [a]
V.toList
where
rnfElems :: [Any] -> ()
rnfElems :: [Any] -> ()
rnfElems [] = ()
rnfElems (Any
x:[Any]
xs) = Any
x Any -> () -> ()
`seq` [Any] -> ()
rnfElems [Any]
xs
noInlineUnsafeCo :: forall a b. a -> b
{-# NOINLINE noInlineUnsafeCo #-}
noInlineUnsafeCo :: a -> b
noInlineUnsafeCo = a -> b
forall a b. a -> b
unsafeCoerce