{-# LANGUAGE MagicHash, UnboxedTuples #-}
module Clash.GHCi.Util where
import GHC.Exts
import GHC.Types
anyToPtr :: a -> IO (Ptr ())
anyToPtr :: a -> IO (Ptr ())
anyToPtr a
x =
(State# RealWorld -> (# State# RealWorld, Ptr () #)) -> IO (Ptr ())
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO (\State# RealWorld
s -> case a -> State# RealWorld -> (# State# RealWorld, Addr# #)
forall a. a -> State# RealWorld -> (# State# RealWorld, Addr# #)
anyToAddr# a
x State# RealWorld
s of
(# State# RealWorld
s', Addr#
addr #) -> (# State# RealWorld
s', Addr# -> Ptr ()
forall a. Addr# -> Ptr a
Ptr Addr#
addr #)) :: IO (Ptr ())