[clean up a lot of cruft
John Meacham <john@repetae.net>**20050916090504] hunk ./E/E.hs 2
-module E.E(module E.E, subst) where
+module E.E where
hunk ./E/E.hs 30
-
hunk ./E/E.hs 40
-
hunk ./E/E.hs 41
-    --show (LitInt x _) = show x
-    --show (LitFrac r _) = show r
hunk ./E/E.hs 49
-        --(LitCons a es e) -> do es <- mapM f es; e <- f e; return (LitCons a es e)
hunk ./E/E.hs 51
-        --LitFrac r t -> do t <- f t; return $ LitFrac r t
hunk ./E/E.hs 53
-
hunk ./E/E.hs 83
+-- | extract out EAp nodes a value and the arguments it is applied to.
+fromAp :: E -> (E,[E])
hunk ./E/E.hs 88
---fromAp _ = fail "not application"
hunk ./E/E.hs 89
---fromPi (EPi (EBind ts e)) = (e,ts)
---fromLam (ELam (EBind ts e)) = (e,ts)
+-- | deconstruct EPi terms, getting function argument types.
hunk ./E/E.hs 91
+fromPi :: E -> (E,[TVr])
hunk ./E/E.hs 96
--- (b,ls) = fromLam (foldr ELam b ls)
+-- | deconstruct ELam term.
+
+fromLam :: E -> (E,[TVr])
hunk ./E/E.hs 109
-
hunk ./E/E.hs 138
---tvrNum _ = 0
hunk ./E/E.hs 145
---instance FunctorM Pat where
---    fmapM f (PatLit l) = fmapM f l >>= return . PatLit
---    fmapM _ PatWildCard = return PatWildCard
hunk ./E/E.hs 147
-
-
-
---type Alt e = (Lit TVr e,e)
hunk ./E/E.hs 154
---litHead (LitFrac x _) = LitFrac x ()
hunk ./E/E.hs 163
---patToLitEE (LitFrac x t) = LitFrac x t
hunk ./E/E.hs 171
---data Pat e = PatLit !(Lit e) | PatWildCard
---	deriving(Data,Show, Eq, Typeable)
---    {-!derive: is, GhcBinary !-}
hunk ./E/E.hs 178
---    (<) (TVr x _) (TVr y _) = (<) x y
---    (<=) (TVr x _) (TVr y _) = (<=) x y
---    (>=) (TVr x _) (TVr y _) = (>=) x y
---    (>) (TVr x _) (TVr y _) = (>) x y
+    x < y = tvrIdent x < tvrIdent y
+    x > y = tvrIdent x > tvrIdent y
+    x >= y = tvrIdent x >= tvrIdent y
+    x <= y = tvrIdent x <= tvrIdent y
hunk ./E/E.hs 245
+eBox :: E
hunk ./E/E.hs 247
+
+eStar :: E
hunk ./E/E.hs 255
---ePi t (EPi (EBind ts b)) = EPi $  EBind (t:ts) b
---ePi t b = EPi $  EBind [t] b
-
hunk ./E/E.hs 259
---eLam t (ELam (EBind ts b)) = ELam $  EBind (t:ts) b
---eLam t b = ELam $  EBind [t] b
hunk ./E/E.hs 261
-
-{-
+-- | throw away first n EPi terms
+discardArgs :: Int -> E -> E
hunk ./E/E.hs 264
-discardArgs n (EPi (EBind ts b))
-    | n == lts = b
-    | n < lts = EPi (EBind (drop n ts) b)
-    where
-    lts = length ts
-discardArgs _ _ = error "discardArgs"
--}
-
-discardArgs 0 e = e
hunk ./E/E.hs 268
+-- | construct a letret, throwing away empty declarations
+eLetRec :: [(TVr,E)] -> E -> E
hunk ./E/E.hs 284
--- compatable approximation
+-- | compatable approximation
hunk ./E/E.hs 303
---freeVSet :: E -> IS.IntSet
---freeVList :: E -> [Int]
hunk ./E/E.hs 304
-
hunk ./E/E.hs 335
-    fv (ELam (TVr { tvrIdent = ( i), tvrType =  t }) e) =  (delete i $ fv e <> fv t)
-    --fv (ELam (TVr Nothing t) e) = fv t <> fv e
-    fv (EPi (TVr { tvrIdent =  ( i), tvrType =  t}) e) =  (delete i $ fv e <> fv t)
-    --fv (EPi (TVr Nothing t) e) = fv t <> fv e
+    fv (ELam (TVr { tvrIdent = i, tvrType = t}) e) =  (delete i $ fv e <> fv t)
+    fv (EPi (TVr { tvrIdent =  i, tvrType = t}) e) =  (delete i $ fv e <> fv t)
hunk ./E/E.hs 340
-
-    --fv (ECase e alts ) = IM.unions ( foldl (flip ($)) [fv e] [ \x -> fvPat p:fv e:x | (p,e) <- alts] )
hunk ./E/E.hs 348
-    --fvPat (PatLit l) = fvLit l
-    --fvPat _ = IM.empty
hunk ./E/E.hs 351
-{-
-decomposeDefns :: [(TVr, E)] -> [Either (TVr, E) [(TVr,E)]]
-decomposeDefns bs = map g (scc (map f bs)) where
-    mp = IM.fromList [ (i,e) | e@(TVr (Just i) _,_) <- bs]
-    ml i = IM.find i mp
-    f (TVr (Just i) _, e) = (i,freeVList e `union` IM.keys mp)
-    g [x] = case ( ml x) of
-        t@(_,e) | x `elem` freeVList e -> Right [t]
-                | otherwise -> Left t
-    g xs = Right (map ml xs)
--}
+-- | separate out recursive strongly connected components from a declaration list
hunk ./E/E.hs 359
+
+-- | pull apart an ELet and separate out recursive strongly connected components from an ELet.
hunk ./E/E.hs 365
-{-
-decomposeDefns' :: [(TVr, E)] -> [Either ((TVr, E),[Int]) [((TVr,E),[Int])]]
-decomposeDefns' bs = map f mp where
-    mp = G.stronglyConnComp [ (v,i,freeVars t `mappend` freeVars e) | v@(TVr (i) t,e) <- bs]
-    f (AcyclicSCC v) = Left v
-    f (CyclicSCC vs) = Right vs
--}
hunk ./E/E.hs 384
---typ (ECase _ ((PatLit (LitCons _ es _),e):_) ) = discardArgs (length es) $ typ e
---typ (ECase _ ((PatLit _,e):_) ) = typ e
---typ (ECase e' ((PatWildCard,e):_) ) = typ (eAp e e')
hunk ./E/E.hs 388
---typ x = error $ "unknown expr: " ++ show x
hunk ./E/E.hs 395
---    getType (LitFrac _ t) = t
hunk ./E/E.hs 406
+
+
hunk ./E/Values.hs 12
+import {-# SOURCE #-} E.Subst
hunk ./E/Values.hs 37
---toString :: Monad m => E -> m String
---toString (ELit (LitCons n [(ELit (LitInt c t)),b] _)) | vCons == n, t == tChar  = toString b >>= \x -> return (chr (fromIntegral c):x)
-----toString (ELit (LitCons n [] _)) | toAtom "[]" == n = return []
---toString e | e == eNil tString = return ""
---toString _ = fail "toString: not string"
-
---fromString :: String -> E
---fromString (x:xs) = eCons (ELit (LitInt (fromIntegral $ ord x) tChar)) $ fromString xs
---fromString "" = eNil tString
hunk ./E/Values.hs 107
---    f (p@(PatWildCard,_):_) = [p]
---    f (p:ps) = p:f ps
---    f [] = [(PatWildCard,eLam (TVr Nothing (typ e)) els)]
hunk ./E/Values.hs 108
--- This takes care of types right away, it simplifies various other things to do it this way.
-eLet (TVr { tvrIdent = 0 }) _ = id
+-- | This takes care of types right away, it simplifies various other things to do it this way.
+eLet :: TVr -> E -> E -> E
+eLet TVr { tvrIdent = 0 } _ = id
hunk ./E/Values.hs 134
---isBottom e@ECase {} = eCase
hunk ./E/Values.hs 176
---prim_const rs s t = EPrim (APrim (CConst s t))
-
---isAtomic (ELit (LitInt {})) = True
---isAtomic (ELit (LitChar {})) = True
---isAtomic (ELit (LitFrac {})) = True
---isAtomic (ELit (LitCons _ [] _)) = True
---isAtomic _ = False
hunk ./Grin/Whiz.hs 188
-        -- | V n <- v, n < 0 = return var
-        -- | otherwise = error $ "Var not found: " ++ show var
hunk ./Makefile 63
-	haddock -h $(filter-out %/HsParser.hs FrontEnd/Representation.hs C/Gen.hs DData/% E/Subst.hs, $(OBJS:.o=.hs)) -o hsdocs
+	haddock -h $(filter-out SelfTest.hs %/HsParser.hs FrontEnd/Representation.hs C/Gen.hs DData/% E/Subst.hs, $(OBJS:.o=.hs)) -o hsdocs
hunk ./Name.hs 180
-    --tIntzh = toName TypeConstructor $ hsname "Prelude" "Int#"
-    --tCharzh = toName TypeConstructor $ hsname "Prelude" "Char#"