{-# LANGUAGE Unsafe #-}
module Clash.Promoted.Nat.Unsafe
(unsafeSNat)
where
import Data.Reflection (reifyNat)
import Unsafe.Coerce (unsafeCoerce)
import Clash.Promoted.Nat (SNat, snatProxy)
unsafeSNat :: Integer -> SNat k
unsafeSNat :: Integer -> SNat k
unsafeSNat i :: Integer
i = Integer
-> (forall (n :: Nat). KnownNat n => Proxy n -> SNat k) -> SNat k
forall r.
Integer -> (forall (n :: Nat). KnownNat n => Proxy n -> r) -> r
reifyNat Integer
i ((forall (n :: Nat). KnownNat n => Proxy n -> SNat k) -> SNat k)
-> (forall (n :: Nat). KnownNat n => Proxy n -> SNat k) -> SNat k
forall a b. (a -> b) -> a -> b
$ (\p :: Proxy n
p -> SNat n -> SNat k
forall a b. a -> b
unsafeCoerce (Proxy n -> SNat n
forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> SNat n
snatProxy Proxy n
p))
{-# NOINLINE unsafeSNat #-}