module Data.IsEvaluated(isEvaluated) where
import GHC.Vacuum
import GHC.Vacuum.ClosureType
isEvaluated :: a -> IO Bool
isEvaluated a = discriminate `fmap` closureType a
where
discriminate CONSTR = True
discriminate CONSTR_1_0 = True
discriminate CONSTR_0_1 = True
discriminate CONSTR_2_0 = True
discriminate CONSTR_1_1 = True
discriminate CONSTR_0_2 = True
discriminate CONSTR_STATIC = True
discriminate CONSTR_NOCAF_STATIC = True
discriminate FUN = True
discriminate FUN_1_0 = True
discriminate FUN_0_1 = True
discriminate FUN_2_0 = True
discriminate FUN_1_1 = True
discriminate FUN_0_2 = True
discriminate FUN_STATIC = True
discriminate PAP = True
discriminate IND = True
discriminate IND_OLDGEN = True
discriminate IND_PERM = True
discriminate IND_OLDGEN_PERM = True
discriminate IND_STATIC = True
discriminate _ = False