| 1 |
{-# LANGUAGE MagicHash #-} |
| 2 |
{-# LANGUAGE UnboxedTuples #-} |
| 3 |
|
| 4 |
-- | Utilities for GHCi. |
| 5 |
module Clash.GHCi.Util where |
| 6 |
|
| 7 |
-- NOTE: Avoid importing GHC modules here, because the primary purpose |
| 8 |
-- of this module is to not use UnboxedTuples in a module that imports |
| 9 |
-- lots of other modules. See issue#13101 for more info. |
| 10 |
|
| 11 |
import GHC.Exts |
| 12 |
import GHC.Types |
| 13 |
|
| 14 |
anyToPtr :: a -> IO (Ptr ()) |
| 15 |
anyToPtr x = |
| 16 |
IO (\s -> case anyToAddr# x s of |
| 17 |
(# s', addr #) -> (# s', Ptr addr #)) :: IO (Ptr ()) |