aboutsummaryrefslogtreecommitdiff
path: root/src/Data/StableName/Extra.hs
blob: f56874077315cec1461090c314a79b43b00fbefe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)