[add a list of names to display in short from when printing E code
John Meacham <john@repetae.net>**20120125214141
 Ignore-this: 61fe6d698e1e7c4ea6ac65ae2b650365
] hunk ./src/E/Show.hs 22
+import qualified Data.Map as Map
hunk ./src/E/Show.hs 56
-{-
-instance PPrint (SEM Doc) a => PPrint (SEM Doc) (Lit a E)  where
-    pprintAssoc a i lit = f lit where
-        f (LitInt i (ELit LitCons { litName = n })) | Just l <- lookup n enumList, i >= 0 && fromIntegral i < length l = text $ l !! (fromIntegral i)
-        f (LitInt i _) = text $ show i
-        f LitCons { litName = s, litArgs = es } | Just n <- fromTupname s , n == length es = do
-            es' <- mapM pprint es
-            return $ tupled es'
-        f LitCons { litName = s, litArgs = es } | Just n <- fromUnboxedNameTuple s, n == length es = do
-            es' <- mapM pprint es
-            return $ encloseSep (text "(# ") (text " #)") (text ", ") es'
-        f LitCons { litName = n, litArgs = [a,b] } | dc_Cons == n  = do
-            a' <- showBind a
-            b' <- showBind b
-            return $ a' `cons` b'
-        f LitCons { litName = n, litArgs = [e] } | tc_List == n = do
-            e <- pprint e
-            return $ (char '[' <> e <> char ']')
-        f LitCons { litName = n, litArgs = [] } | dc_EmptyList == n = return $ text "[]"
-        f LitCons { litName = n, litArgs = [v] }
-            | n == dc_Integer = go "Integer#"
-            | n == dc_Int     = go "Int#"
-            | n == dc_Char    = go "Char#"
-          where go n = do
-                    se <- pprintAssoc AssocNone 10 v
-                    return $ atom (text n) `app` se
-        f LitCons { litName = s, litArgs = es, litType = t, litAliasFor = Just af } | dump FD.EAlias = do
-            es' <- mapM showBind es
-            se <- showE af
-            return $ foldl appCon (atom (tshow s <> char '@' <> parens (unparse se))) es' -- `inhabit` prettye t
-        f LitCons { litName = s, litArgs = es, litType = t } = do
-            es' <- mapM showBind es
-            return $ foldl appCon (atom (tshow s)) es' -- `inhabit` prettye t
-        cons = bop (R,5) (text ":")
-        -}
-
hunk ./src/E/Show.hs 85
-        f LitCons { litName = n, litArgs = [v] }
-            | n == dc_Integer = go "Integer#"
-            | n == dc_Int     = go "Int#"
-            | n == dc_Char    = go "Char#"
-          where go n = do
-                    se <- showBind v
-                    return $ atom (text n) `app` se
-        f LitCons { litName = s, litArgs = es, litType = t, litAliasFor = Just af } | dump FD.EAlias = do
+--        f LitCons { litName = n, litArgs = [v] }
+--        f LitCons { litName = n, litArgs = [v] }
+--            | n == dc_Integer = go "Integer#"
+--            | n == dc_Int     = go "Int#"
+--            | n == dc_Char    = go "Char#"
+--          where go n = do
+--                    se <- showBind v
+--                    return $ atom (text n) `app` se
+        f LitCons { litName = s, litArgs = es, litType = t,
+		    litAliasFor = Just af } | dump FD.EAlias = do
+	    s <- return $ fromMaybe s (Map.lookup s shortName)
hunk ./src/E/Show.hs 100
+	    s <- return $ fromMaybe s (Map.lookup s shortName)
hunk ./src/E/Show.hs 109
---class EPrint a where
---    eprint :: a -> SEM Doc
---    eprintAssoc :: Assoc -> a -> Int -> SEM Doc
---    eprintAssoc _ _ a = eprint a
---    eprint a = eprintAssoc AssocNone (-1) a
-
hunk ./src/E/Show.hs 150
+short_names = [
+      tc_Bool,     tc_Char,    tc_IO,      tc_ACIO,    tc_State_,  tc_RealWorld,
+      tc_Ordering, tc_Bool_,   tc_Ratio,   tc_Float,   tc_Double,  tc_Ptr,
+      tc_FunPtr,   tc_CInt,    tc_CUInt,   tc_CLong,   tc_CULong,  tc_CLLong,
+      tc_CULLong,  tc_CShort,  tc_CUShort, tc_CWchar,  tc_CWint,   tc_CChar,
+      tc_CSChar,   tc_CUChar,  tc_CInt,    tc_CUInt,   tc_CTime,   tc_CSize,
+      tc_CClock,   tc_Integer, tc_Int,     tc_Int8,    tc_Int16,   tc_Int32,
+      tc_Int64,    tc_IntMax,  tc_IntPtr,  tc_Word,    tc_Word8,   tc_Word16,
+      tc_Word32,   tc_Word64,  tc_WordMax, tc_WordPtr, tc_Addr_,   tc_FunAddr_,
+      tc_Char_,    dc_Boolzh,  dc_Char,    dc_Int,     dc_Integer, dc_Word ]
+
+shortName = Map.fromList [ (x, toUnqualified x) | x <- short_names]
+
hunk ./src/E/Show.hs 169
-        f e | e == tBool     = return $ atom $ text "Bool"
-        f e | e == tBoolzh   = return $ atom $ text "Bool_"
-        f e | e == tChar     = return $ atom $ text "Char"
-        f e | e == tInt      = return $ atom $ text "Int"
-        f e | e == tInteger  = return $ atom $ text "Integer"
hunk ./src/E/Show.hs 172
-        f e | e == vFalse    = return $ atom $ text "False"
-        f e | e == vTrue     = return $ atom $ text "True"