diff --git a/common/GenericUtils.hs b/common/GenericUtils.hs index 78fe23d..acca2e4 100644 --- a/common/GenericUtils.hs +++ b/common/GenericUtils.hs @@ -39,6 +39,7 @@ import Data.Typeable import System.IO.Unsafe import qualified AST as A +import Utils -- | A type identifier. type TypeKey = Int @@ -47,9 +48,6 @@ type TypeKey = Int typeKey :: Typeable a => a -> TypeKey typeKey x = unsafePerformIO $ typeRepKey $ typeOf x --- | Container for 'Data' items. -data DataBox = forall a. (Typeable a, Data a) => DataBox a - -- | Given a witness for a type, return witnesses for all the types that its -- constructors take. constrArgTypes :: (Data a, Typeable a) => a -> [DataBox] diff --git a/common/Utils.hs b/common/Utils.hs index e59d313..e64789a 100644 --- a/common/Utils.hs +++ b/common/Utils.hs @@ -23,6 +23,7 @@ module Utils where import Control.Monad.State import Data.Array.IArray import Data.List +import Data.Generics (Data) import qualified Data.Map as Map import Data.Maybe import Data.Ord @@ -296,3 +297,6 @@ makeArraySize size def arr = array size [(i,arrayLookupWithDefault def arr i) | -- This is like '(\/\/)'. replaceAt :: Int -> a -> [a] -> [a] replaceAt n rep es = [if i == n then rep else e | (e, i) <- zip es [0..]] + +-- | A type that can contain any 'Data' item. +data DataBox = forall t. Data t => DataBox t