module FlattenTypes where
import Data.Traversable
+import qualified Data.Foldable as Foldable
import qualified Control.Monad.State as State
import CoreSyn
}
deriving (Show, Eq, Ord)
+-- | Is this HsValueUse a state use?
+isStateUse :: HsValueUse -> Bool
+isStateUse (State _) = True
+isStateUse _ = False
+
-- | A map from a Haskell value to the use of each single value
type HsUseMap = HsValueMap HsValueUse
hsFuncRes :: HsUseMap
} deriving (Show, Eq, Ord)
+hasState :: HsFunction -> Bool
+hasState hsfunc =
+ any (Foldable.any isStateUse) (hsFuncArgs hsfunc)
+ || Foldable.any isStateUse (hsFuncRes hsfunc)
+
-- | A flattened function application
data FApp sigid = FApp {
appFunc :: HsFunction,