aboutsummaryrefslogtreecommitdiff
path: root/src/Data/StableName
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-08-01 22:04:52 +0200
committerTom Smeding <tom@tomsmeding.com>2024-08-01 22:04:52 +0200
commit250e3beae7a961fc740f775a563c303b4cc390fe (patch)
treeccbb8a090cdb082d86c0651935eeb986e2cddcea /src/Data/StableName
Initial
Diffstat (limited to 'src/Data/StableName')
-rw-r--r--src/Data/StableName/Extra.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Data/StableName/Extra.hs b/src/Data/StableName/Extra.hs
new file mode 100644
index 0000000..f568740
--- /dev/null
+++ b/src/Data/StableName/Extra.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE BangPatterns #-}
+{-# OPTIONS_GHC -fno-full-laziness -fno-cse #-}
+module Data.StableName.Extra (
+ StableName,
+ makeStableName',
+) where
+
+import GHC.StableName
+import System.IO.Unsafe
+
+
+-- | This function evaluates its argument to WHNF and returns a stable name for
+-- the evaluation result. This function is not referentially transparent and is
+-- implemented using 'unsafePerformIO'.
+{-# NOINLINE makeStableName' #-}
+makeStableName' :: a -> StableName a
+makeStableName' !x = unsafePerformIO (makeStableName x)