    -- Copyright © 2011 National Institute of Aerospace / Galois, Inc.

    {-# LANGUAGE ExistentialQuantification #-}
    {-# LANGUAGE Safe                      #-}

    module System.Mem.StableName.Dynamic
      ( DynStableName(..)
      , hashDynStableName
      , makeDynStableName
      ) where

    import System.Mem.StableName (StableName, eqStableName, makeStableName,
                                  hashStableName)

    data DynStableName = forall a . DynStableName (StableName a)

    makeDynStableName :: a -> IO DynStableName
    makeDynStableName :: forall a. a -> IO DynStableName
    makeDynStableName a
    x =
      do
        stn <- a -> IO (StableName a)
    forall a. a -> IO (StableName a)
    makeStableName a
    x
        return (DynStableName stn)

    hashDynStableName :: DynStableName -> Int
    hashDynStableName :: DynStableName -> Int
    hashDynStableName (DynStableName StableName a
    sn) = StableName a -> Int
    forall a. StableName a -> Int
    hashStableName StableName a
    sn

    instance Eq DynStableName where
      DynStableName StableName a
    sn1 == :: DynStableName -> DynStableName -> Bool
    == DynStableName StableName a
    sn2 = StableName a -> StableName a -> Bool
    forall a b. StableName a -> StableName b -> Bool
    eqStableName StableName a
    sn1 StableName a
    sn2