[Use the new IdMap based substitutions
John Meacham <john@repetae.net>**20060409072627] hunk ./DataConstructors.hs 26
-import Data.Map as Map hiding(map)
+import qualified Data.Map as Map hiding(map)
hunk ./DataConstructors.hs 55
+import Util.SetLike
hunk ./DataConstructors.hs 108
-    constructorMap :: (Map Name Constructor)
+    constructorMap :: (Map.Map Name Constructor)
hunk ./DataConstructors.hs 327
-        ans = doSubst False False (Map.fromList $ zip [2..] (map Just ts)) sl
+        ans = doSubst False False (fromList $ zip [2..] (map Just ts)) sl
hunk ./DataConstructors.hs 340
-toDataTable :: (Map Name Kind) -> (Map Name Type) -> [HsDecl] -> DataTable
+toDataTable :: (Map.Map Name Kind) -> (Map.Map Name Type) -> [HsDecl] -> DataTable
hunk ./DataConstructors.hs 392
-            subst = substMap $ Map.fromList [ (tvrIdent tv ,EVar $ tv { tvrIdent = p }) | EVar tv <- xs | p <- [2,4..] ]
+            subst = substMap $ fromList [ (tvrIdent tv ,EVar $ tv { tvrIdent = p }) | EVar tv <- xs | p <- [2,4..] ]
hunk ./DataConstructors.hs 419
-    sub = substMap $ Map.fromDistinctAscList [ (i,sl) | sl <- xs | i <- [2,4..] ]
+    sub = substMap $ fromDistinctAscList [ (i,sl) | sl <- xs | i <- [2,4..] ]
hunk ./DataConstructors.hs 448
-    sub = substMap $ Map.fromDistinctAscList [ (i,sl) | sl <- xs | i <- [2,4..] ]
+    sub = substMap $ fromDistinctAscList [ (i,sl) | sl <- xs | i <- [2,4..] ]
hunk ./E/Rules.hs 29
+import Data.FunctorM
hunk ./E/Rules.hs 106
-    mp' <- sequence [ do rs' <- mapM f rs; return (k,rs') | (k,rs) <- Map.toAscList mp ]
-    return $ Rules $ Map.fromAscList mp'
+    mp' <- fmapM (mapM f) mp
+    return $ Rules mp'
+    --mp' <- sequence [ do rs' <- mapM f rs; return (k,rs') | (k,rs) <- Map.toAscList mp ]
+    --return $ Rules $ Map.fromAscList mp'
hunk ./E/Rules.hs 205
-            sa = substMap $ Map.fromList [ (tvrIdent t,v) |  Right ds <- as', (t,v) <- ds ]
+            sa = substMap $ fromList [ (tvrIdent t,v) |  Right ds <- as', (t,v) <- ds ]
hunk ./E/Rules.hs 223
-        g e = substMap (Map.fromList [ (tvrIdent t, EVar t) | t <- bs ]) e
+        g e = substMap (fromList [ (tvrIdent t, EVar t) | t <- bs ]) e
hunk ./E/Rules.hs 237
-rsubstMap im e = doSubst False True (Map.map ( (`Map.lookup` im) . tvrIdent) (Map.unions $ (freeVars e :: Map.Map Id TVr):map freeVars (Map.elems im))) e
+rsubstMap im e = doSubst False True (fmap ( (`mlookup` im) . tvrIdent) (unions $ (freeVars e :: IdMap TVr):map freeVars (melems im))) e
hunk ./E/Traverse.hs 25
-import qualified Data.Map as Map
hunk ./E/Traverse.hs 56
-runRename set e = runIdentity $ traverse travOptions { pruneUnreachable = Nothing } (\_ (x,xs) -> (return $ foldl EAp x xs)) mempty (Map.fromDistinctAscList [ (v,NotKnown) | v <- idSetToList set])  e
+runRename set e = runIdentity $ traverse travOptions { pruneUnreachable = Nothing } (\_ (x,xs) -> (return $ foldl EAp x xs)) mempty (idSetToIdMap (const NotKnown) set)  e
hunk ./E/Traverse.hs 64
-    trav_strictness :: Map.Map Int Strict.SA,
+    trav_strictness :: IdMap Strict.SA,
hunk ./E/Traverse.hs 85
-type Subst = Map.Map Int E  -- Map apply anywhere. so should range only over atoms
-type InScope = Map.Map Int Binding
+type Subst = IdMap E  -- Map apply anywhere. so should range only over atoms
+type InScope = IdMap Binding
hunk ./E/Traverse.hs 88
+    deriving(Eq,Ord)
hunk ./E/Traverse.hs 92
-newtype TravM m a = TravM (ReaderT (Map.Map Int Binding) (IdNameT m) a)
+newtype TravM m a = TravM (ReaderT (IdMap Binding) (IdNameT m) a)
hunk ./E/Traverse.hs 110
-    return (maybe NotKnown id $  Map.lookup n x)
+    return (maybe NotKnown id $  mlookup n x)
hunk ./E/Traverse.hs 132
-traverse :: (MonadFix m,Monad m) => TravOptions m -> (Int -> (E,[E]) -> TravM m E) -> Subst -> (Map.Map Int Binding) -> E -> m (E,IdSet)
+traverse :: (MonadFix m,Monad m) => TravOptions m -> (Int -> (E,[E]) -> TravM m E) -> Subst -> (IdMap Binding) -> E -> m (E,IdSet)
hunk ./E/Traverse.hs 135
-        addBoundNames $ freeVars e
-        addBoundNames (Map.keys subst)
-        addBoundNames (Map.keys smap)
-    f :: E -> ReaderT (Map.Map Int Binding, Subst, Int) (IdNameT m) E
+        addBoundNamesIdSet $ freeVars e
+        addBoundNamesIdMap subst
+        addBoundNamesIdMap smap
+    f :: E -> ReaderT (IdMap Binding, Subst, Int) (IdNameT m) E
hunk ./E/Traverse.hs 149
-        case Map.lookup n im of
+        case mlookup n im of
hunk ./E/Traverse.hs 182
-        z (Left (tvr,x):rs) e | worthStricting x, Just (S _) <- Map.lookup (tvrIdent tvr) (trav_strictness tOpt)  = do
+        z (Left (tvr,x):rs) e | worthStricting x, Just (S _) <- mlookup (tvrIdent tvr) (trav_strictness tOpt)  = do
hunk ./E/Traverse.hs 237
-    lb n me n' ne (m,im,lvl) = (Map.insert n me m,if n' /= 0 then Map.insert n' ne im else im ,lvl)
+    lb n me n' ne (m,im,lvl) = (minsert n me m,if n' /= 0 then minsert n' ne im else im ,lvl)
hunk ./E/Traverse.hs 239
-        let ex' = Map.fromList [ (a,b) |  (a,IsBoundTo b) <- ex, isAtomic b ]
-            z (EVar (TVr { tvrIdent = n })) | Just v <- Map.lookup n ex' = v
+        let ex' = fromList [ (a,b) |  (a,IsBoundTo b) <- ex, isAtomic b ] :: IdMap E
+            z (EVar (TVr { tvrIdent = n })) | Just v <- mlookup n ex' = v
hunk ./E/Traverse.hs 242
-        r <- local (\ (a,b,c) ->  (Map.fromList ex `mappend` a, fmap z  b ,c)) x
+        r <- local (\ (a,b,c) ->  (fromList ex `mappend` a, fmap z  b ,c)) x
hunk ./E/Traverse.hs 245
-        r <- local (\ (a,b,c) ->  (a, Map.fromList ex `mappend` b ,c)) x
+        r <- local (\ (a,b,c) ->  (a, fromList ex `mappend` b ,c)) x
hunk ./E/Traverse.hs 261
-        let (Just (EVar nt)) = Map.lookup n tm
+        let (Just (EVar nt)) = mlookup n tm
hunk ./E/Values.hs 24
+import Util.SetLike
hunk ./E/Values.hs 119
-    | sortStarLike ty = ELetRec [(t,e)] (typeSubst mempty (Map.singleton (tvrIdent t) e) e')
+    | sortStarLike ty = ELetRec [(t,e)] (typeSubst mempty (msingleton (tvrIdent t) e) e')
hunk ./E/Values.hs 132
-    ans = eLetRec (as ++ nas) (typeSubst' (Map.fromList [ (n,e) | (TVr { tvrIdent = n },e) <- as]) (Map.fromList [ (n,e) | (TVr { tvrIdent = n },e) <- tas]) e)
+    ans = eLetRec (as ++ nas) (typeSubst' (fromList [ (n,e) | (TVr { tvrIdent = n },e) <- as]) (fromList [ (n,e) | (TVr { tvrIdent = n },e) <- tas]) e)
hunk ./E/Values.hs 144
-                    f = typeSubst' mempty (Map.fromList [ (n,e) | (TVr { tvrIdent = n },e) <- tas])
+                    f = typeSubst' mempty (fromList [ (n,e) | (TVr { tvrIdent = n },e) <- tas])