[cleanup
John Meacham <john@repetae.net>**20110130030643
 Ignore-this: 96b1af39766addb547212ac31f0e9f92
] hunk ./src/E/LetFloat.hs 38
-
-
-
-
hunk ./src/E/LetFloat.hs 82
-
-
-
hunk ./src/E/LetFloat.hs 85
-
hunk ./src/E/LetFloat.hs 110
-
hunk ./src/E/LetFloat.hs 115
-floatInward ::
-    E  -- ^ input term
+floatInward
+    :: E  -- ^ input term
hunk ./src/E/LetFloat.hs 118
-floatInward e = floatInwardE e [] where
+floatInward e = floatInwardE e []
hunk ./src/E/LetFloat.hs 166
-
hunk ./src/E/LetFloat.hs 167
-
hunk ./src/E/LetFloat.hs 191
-
hunk ./src/E/LetFloat.hs 229
-    let imap = Map.fromList $ map (\x -> (x,top_level)) ([ tvrIdent t| (t,_) <-  programDs prog ] ++ idSetToList (progExternalNames prog `mappend` progSeasoning prog))
+    let imap = Map.fromList $ map (\x -> (x,top_level)) ([ tvrIdent t| (t,_) <-  programDs prog ] ++
+            idSetToList (progExternalNames prog `mappend` progSeasoning prog))
hunk ./src/E/LetFloat.hs 234
-
-
hunk ./src/E/LetFloat.hs 281
-
hunk ./src/E/LetFloat.hs 288
-
hunk ./src/E/LetFloat.hs 290
-
-letBindAll ::
-    DataTable  -- ^ the data table for expanding newtypes
+letBindAll
+    :: DataTable  -- ^ the data table for expanding newtypes
hunk ./src/E/LetFloat.hs 322
-
-
hunk ./src/E/LetFloat.hs 326
-
-
-
hunk ./src/Grin/Grin.hs 72
-import Util.Perhaps
-import Util.SetLike
hunk ./src/Grin/Grin.hs 73
-import Util.HasSize
hunk ./src/Grin/Grin.hs 74
+import Util.HasSize
+import Util.Perhaps
+import Util.SetLike
hunk ./src/Grin/Grin.hs 84
--- than examining them. (types may not be constructed at run-time) ( do we need
--- this for polymorphic recursion? )
-
-data TyThunk =
-    TyNotThunk                 -- ^ not the thunk
-    | TyPApp (Maybe Ty) Atom   -- ^ can be applied to (possibly) an argument, and what results
-    | TySusp Atom              -- ^ can be evaluated and calls what function
-    deriving(Eq,Show)
-
-data TyTy = TyTy {
-    tySlots :: [Ty],
-    tyReturn :: [Ty],
-    tyThunk :: TyThunk,
-    tySiblings :: Maybe [Atom]
-}
-
-tyTy = TyTy { tySlots = [], tyReturn = [], tySiblings = Nothing, tyThunk = TyNotThunk }
-
-newtype TyEnv = TyEnv (GMap Atom TyTy)
-    deriving(Monoid)
-
-
-tagHole = toAtom "@hole"
-
-gEval :: Val -> Exp
-gEval x = BaseOp Eval [x]
-
--- lazy node sptr_t
-tyINode = TyINode
--- strict node wptr_t
-tyDNode = TyNode
-
-
-instance TypeNames Ty where
-    tIntzh = TyPrim (Op.bits32)
-    tEnumzh = TyPrim (Op.bits16)
-    tCharzh = TyPrim (Op.bits32)
-
-data Callable = Continuation | Function | Closure | LocalFunction | Primitive'
-    deriving(Eq,Ord,Show)
-
-
-type Tag = Atom
-
-newtype Var = V Int
-    deriving(Eq,Ord,Enum)
-
-instance Show Var where
-    showsPrec _ (V n) xs = 'v':shows n xs
-
-
-
-{-
-
-data VCont = VCont Val VContext
-
-data VContext = PrimApp PrimApp VCont | Decons Tag Int VCont | ContUnknown
-
-
--}
+-- than examining them. (types may not be constructed at run-time)
hunk ./src/Grin/Grin.hs 100
-    | StoreNode !Bool       -- create a new node, Bool is true if it should be an direct node, the second val is the region
+    | StoreNode !Bool       -- create a new node, Bool is true if it should be a direct node, the second val is the region
hunk ./src/Grin/Grin.hs 187
+data Callable = Continuation | Function | Closure | LocalFunction | Primitive'
+    deriving(Eq,Ord,Show)
hunk ./src/Grin/Grin.hs 190
+type Tag = Atom
+
+newtype Var = V Int
+    deriving(Eq,Ord,Enum)
hunk ./src/Grin/Grin.hs 202
+-- Type information table (TyEnv)
+
+data TyThunk
+    = TyNotThunk               -- ^ not the thunk
+    | TyPApp (Maybe Ty) Atom   -- ^ can be applied to (possibly) an argument, and what results
+    | TySusp Atom              -- ^ can be evaluated and calls what function
+    deriving(Eq,Show)
+
+data TyTy = TyTy {
+    tySlots :: [Ty],
+    tyReturn :: [Ty],
+    tyThunk :: TyThunk,
+    tySiblings :: Maybe [Atom]
+}
+
+tyTy = TyTy { tySlots = [], tyReturn = [], tySiblings = Nothing, tyThunk = TyNotThunk }
+
+newtype TyEnv = TyEnv (GMap Atom TyTy)
+    deriving(Monoid)
+
+-- random utility values
+
+lamExp (_ :-> e) = e
+lamBind (b :-> _) = b
+
+isVar Var {} = True
+isVar _ = False
+
+tagHole = toAtom "@hole"
+
+gEval :: Val -> Exp
+gEval x = BaseOp Eval [x]
+
+tyINode = TyINode -- ^ lazy node sptr_t
+tyDNode = TyNode  -- ^ strict node wptr_t
+
hunk ./src/Grin/Grin.hs 241
-
hunk ./src/Grin/Grin.hs 248
-
hunk ./src/Grin/Grin.hs 279
-instance Show Ty where
-    show TyNode = "N"
-    show TyINode = "I"
-    show (TyPtr t) = '&':show t
-    show (TyUnit) = "()"
-    show (TyPrim t) = show t
-    show TyRegion = "M"
-    show TyGcContext = "GC"
-    show (TyRegister t) = 'r':show t
-    show (TyCall c as rt) = show c <> tupled (map show as) <+> "->" <+> show rt
-    show TyUnknown = "?"
-
-
-instance Show Val where
-    -- showsPrec _ s | Just st <- fromVal s = text $ show (st::String)
-    showsPrec _ (NodeC t []) = parens $ (fromAtom t)
-    showsPrec _ (NodeC t vs) = parens $ (fromAtom t) <+> hsep (map shows vs)
-    showsPrec _ (Index v o) = shows v <> char '[' <> shows o <> char ']'
-    showsPrec _ (Var (V i) t)
-        | TyINode <- t = text "ni" <> tshow i
-        | TyNode <- t = text "nd" <> tshow i
-        | TyRegion <- t = text "m" <> tshow i
-        | TyRegister ty <- t = text "r" <> tshow (Var (V i) ty)
-        | TyGcContext <- t = text "gc" <> tshow i
-        | TyPtr t' <- t = text "p" <> shows (Var (V i) t')
-        | TyPrim Op.TyBool <- t  = char 'b' <> tshow i
-        | TyPrim (Op.TyBits _ Op.HintFloat) <- t  = char 'f' <> tshow i
-        | TyPrim (Op.TyBits _ Op.HintCharacter) <- t  = char 'c' <> tshow i
-        | TyPrim (Op.TyBits (Op.Bits 8)  _) <- t  = char 'o' <> tshow i      -- octet
-        | TyPrim (Op.TyBits (Op.Bits 16)  _) <- t  = char 'h' <> tshow i     -- half
-        | TyPrim (Op.TyBits (Op.Bits 32)  _) <- t  = char 'w' <> tshow i     -- word
-        | TyPrim (Op.TyBits (Op.Bits 64)  _) <- t  = char 'd' <> tshow i     -- doubleword
-        | TyPrim (Op.TyBits (Op.Bits 128)  _) <- t  = char 'q' <> tshow i    -- quadword
-        | TyPrim (Op.TyBits (Op.BitsArch Op.BitsPtr)  _) <- t  = text "bp" <> tshow i
-        | TyPrim (Op.TyBits (Op.BitsArch Op.BitsMax)  _) <- t  = text "bm" <> tshow i
-        | TyPrim (Op.TyBits _ _) <- t  = char 'l' <> tshow i
-        | otherwise = char 'v' <> tshow i
-    showsPrec _ (Lit i _)  = tshow i
-    showsPrec _ Unit  = showString "()"
-    showsPrec _ (Const v) = char '&' <> shows v
-    showsPrec _ (Item a  ty) = tshow a <> text "::" <> tshow ty
-    showsPrec _ (ValUnknown ty) = text "?::" <> tshow ty
-    showsPrec _ (ValPrim aprim xs _) = tshow aprim <> tupled (map tshow xs)
-
hunk ./src/Grin/Grin.hs 319
-    'F':xs ->  TagSusp True (toAtom $ 'f':xs)
-    'B':xs ->  TagSusp True (toAtom $ 'b':xs)
+    'F':xs -> TagSusp True (toAtom $ 'f':xs)
+    'B':xs -> TagSusp True (toAtom $ 'b':xs)
hunk ./src/Grin/Grin.hs 323
+    'C':_  -> TagDataCons
+    'T':_  -> TagTypeCons
hunk ./src/Grin/Grin.hs 327
-    'C':_ -> TagDataCons
-    'T':_ -> TagTypeCons
hunk ./src/Grin/Grin.hs 329
-
hunk ./src/Grin/Grin.hs 338
-
-
hunk ./src/Grin/Grin.hs 346
-
-
hunk ./src/Grin/Grin.hs 413
-
hunk ./src/Grin/Grin.hs 445
+-- CanType instances
hunk ./src/Grin/Grin.hs 491
+-- FreeVars instances
+
hunk ./src/Grin/Grin.hs 665
-lamExp (_ :-> e) = e
-lamBind (b :-> _) = b
+-- Show instances
hunk ./src/Grin/Grin.hs 667
-isVar Var {} = True
-isVar _ = False
+instance Show Var where
+    showsPrec _ (V n) xs = 'v':shows n xs
+
+instance Show Ty where
+    show TyNode = "N"
+    show TyINode = "I"
+    show (TyPtr t) = '&':show t
+    show (TyUnit) = "()"
+    show (TyPrim t) = show t
+    show TyRegion = "M"
+    show TyGcContext = "GC"
+    show (TyRegister t) = 'r':show t
+    show (TyCall c as rt) = show c <> tupled (map show as) <+> "->" <+> show rt
+    show TyUnknown = "?"
+
+
+instance Show Val where
+    -- showsPrec _ s | Just st <- fromVal s = text $ show (st::String)
+    showsPrec _ (NodeC t []) = parens $ (fromAtom t)
+    showsPrec _ (NodeC t vs) = parens $ (fromAtom t) <+> hsep (map shows vs)
+    showsPrec _ (Index v o) = shows v <> char '[' <> shows o <> char ']'
+    showsPrec _ (Var (V i) t)
+        | TyINode <- t = text "ni" <> tshow i
+        | TyNode <- t = text "nd" <> tshow i
+        | TyRegion <- t = text "m" <> tshow i
+        | TyRegister ty <- t = text "r" <> tshow (Var (V i) ty)
+        | TyGcContext <- t = text "gc" <> tshow i
+        | TyPtr t' <- t = text "p" <> shows (Var (V i) t')
+        | TyPrim Op.TyBool <- t  = char 'b' <> tshow i
+        | TyPrim (Op.TyBits _ Op.HintFloat) <- t  = char 'f' <> tshow i
+        | TyPrim (Op.TyBits _ Op.HintCharacter) <- t  = char 'c' <> tshow i
+        | TyPrim (Op.TyBits (Op.Bits 8)  _) <- t  = char 'o' <> tshow i      -- octet
+        | TyPrim (Op.TyBits (Op.Bits 16)  _) <- t  = char 'h' <> tshow i     -- half
+        | TyPrim (Op.TyBits (Op.Bits 32)  _) <- t  = char 'w' <> tshow i     -- word
+        | TyPrim (Op.TyBits (Op.Bits 64)  _) <- t  = char 'd' <> tshow i     -- doubleword
+        | TyPrim (Op.TyBits (Op.Bits 128)  _) <- t  = char 'q' <> tshow i    -- quadword
+        | TyPrim (Op.TyBits (Op.BitsArch Op.BitsPtr)  _) <- t  = text "bp" <> tshow i
+        | TyPrim (Op.TyBits (Op.BitsArch Op.BitsMax)  _) <- t  = text "bm" <> tshow i
+        | TyPrim (Op.TyBits _ _) <- t  = char 'l' <> tshow i
+        | otherwise = char 'v' <> tshow i
+    showsPrec _ (Lit i _)  = tshow i
+    showsPrec _ Unit  = showString "()"
+    showsPrec _ (Const v) = char '&' <> shows v
+    showsPrec _ (Item a  ty) = tshow a <> text "::" <> tshow ty
+    showsPrec _ (ValUnknown ty) = text "?::" <> tshow ty
+    showsPrec _ (ValPrim aprim xs _) = tshow aprim <> tupled (map tshow xs)
+
+-- misc instances
+
+instance TypeNames Ty where
+    tIntzh = TyPrim (Op.bits32)
+    tEnumzh = TyPrim (Op.bits16)
+    tCharzh = TyPrim (Op.bits32)
hunk ./src/Grin/Optimize.hs 1
-
hunk ./src/Grin/Optimize.hs 7
-import StringTable.Atom
hunk ./src/Grin/Optimize.hs 10
+import Options (verbose)
hunk ./src/Grin/Optimize.hs 12
+import StringTable.Atom
hunk ./src/Grin/Optimize.hs 15
-import Util.HasSize
hunk ./src/Grin/Optimize.hs 17
+import Util.HasSize
hunk ./src/Grin/Optimize.hs 19
-import Options (verbose)
hunk ./src/Grin/Optimize.hs 168
-
-
hunk ./src/Grin/Optimize.hs 177
-
hunk ./src/Grin/Optimize.hs 205
-
-
-