{-# LANGUAGE ScopedTypeVariables #-}
module MkZipCfg
- ( AGraph, (<*>), emptyAGraph, withFreshLabel, withUnique
+ ( AGraph, (<*>), catAGraphs
+ , emptyAGraph, withFreshLabel, withUnique
, mkMiddle, mkMiddles, mkLast, mkZTail, mkBranch, mkLabel, mkIfThenElse, mkWhileDo
, outOfLine
, emptyGraph, graphOfMiddles, graphOfZTail
infixr 3 <*>
(<*>) :: AGraph m l -> AGraph m l -> AGraph m l
+catAGraphs :: [AGraph m l] -> AGraph m l
+
-- | A graph is built up by splicing together graphs each containing a
-- single node (where a label is considered a 'first' node. The empty
-- graph is a left and right unit for splicing. All of the AGraph
AGraph f1 <*> AGraph f2 = AGraph f
where f g = f2 g >>= f1 -- note right associativity
+catAGraphs = foldr (<*>) emptyAGraph
+
emptyAGraph = AGraph return
graphOfAGraph (AGraph f) = f emptyGraph
goto L1; L2: ...stuff...
-}
+
+-- | The string argument to 'freshBlockId' was originally helpful in debugging
+-- the Quick C-- compiler, so I have kept it here even though at present it is
+-- thrown away at this spot---there's no reason a BlockId couldn't one day carry
+-- a string.
+
+freshBlockId :: String -> UniqSM BlockId
+freshBlockId _ = do { u <- getUniqueUs; return $ BlockId u }
+
_unused :: FS.FastString
_unused = undefined