X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Fcmm%2FMkZipCfg.hs;h=a0dcf11e8ae6e706091c91acd62bb7114ca6898d;hb=f33b7c7044e8f007aff400633ef01fe91d2fb567;hp=7df775fa90974f6d6d43b55012766048a1e7d226;hpb=d8f6f78cd8342fcfcb4a2789d7f9629123778f54;p=ghc-hetmet.git diff --git a/compiler/cmm/MkZipCfg.hs b/compiler/cmm/MkZipCfg.hs index 7df775f..a0dcf11 100644 --- a/compiler/cmm/MkZipCfg.hs +++ b/compiler/cmm/MkZipCfg.hs @@ -1,6 +1,7 @@ {-# LANGUAGE ScopedTypeVariables #-} module MkZipCfg - ( AGraph, (<*>), emptyAGraph, withFreshLabel, withUnique + ( AGraph, (<*>), sequence + , emptyAGraph, withFreshLabel, withUnique , mkMiddle, mkMiddles, mkLast, mkZTail, mkBranch, mkLabel, mkIfThenElse, mkWhileDo , outOfLine , emptyGraph, graphOfMiddles, graphOfZTail @@ -15,7 +16,7 @@ import Unique import UniqFM import UniqSupply -import Prelude hiding (zip, unzip, last) +import Prelude hiding (zip, unzip, last, sequence) #include "HsVersions.h" @@ -153,6 +154,8 @@ representation is agnostic on this point.) infixr 3 <*> (<*>) :: AGraph m l -> AGraph m l -> AGraph m l +sequence :: [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 @@ -247,6 +250,8 @@ newtype AGraph m l = AGraph (Graph m l -> UniqSM (Graph m l)) AGraph f1 <*> AGraph f2 = AGraph f where f g = f2 g >>= f1 -- note right associativity +sequence = foldr (<*>) emptyAGraph + emptyAGraph = AGraph return graphOfAGraph (AGraph f) = f emptyGraph