on master help sign in
Merge pull request #692 from puffnfresh/show-changes

Show changes

commit22fcec9d871ab87c295ef0f01c7ea8fc63a393d9 authorEdwin Brady <edwin.brady@gmail.com> dateSat 30 Nov 2013, 05:38 (13 years ago) parentada8e73232a592
5 files changed+25−35
src/Core/TT.hs+6−6 src/Idris/AbsSyntax.hs−20 src/Idris/AbsSyntaxTree.hs+17−7 src/Idris/Parser.hs+1−1 src/Pkg/Package.hs+1−1
src/Core/TT.hs+6−6
@@ -273,15 +273,15 @@ instance Show SpecialName where
273273-- Show a name in a way decorated for code generation, not human reading
274274showCG :: Name -> String
275275showCG (UN n) = n
276−showCG (NS n s) = showSep "." (reverse s) ++ "." ++ show n
276+showCG (NS n s) = showSep "." (reverse s) ++ "." ++ showCG n
277277showCG (MN _ "underscore") = "_"
278278showCG (MN i s) = "{" ++ s ++ show i ++ "}"
279279showCG (SN s) = showCG' s
280− where showCG' (WhereN i p c) = show p ++ ":" ++ show c ++ ":" ++ show i
281− showCG' (InstanceN cl inst) = '@':show cl ++ '$':showSep ":" inst
282− showCG' (MethodN m) = '!':show m
283− showCG' (ParentN p c) = show p ++ "#" ++ show c
284− showCG' (CaseN c) = show c ++ "_case"
280+ where showCG' (WhereN i p c) = showCG p ++ ":" ++ showCG c ++ ":" ++ show i
281+ showCG' (InstanceN cl inst) = '@':showCG cl ++ '$':showSep ":" inst
282+ showCG' (MethodN m) = '!':showCG m
283+ showCG' (ParentN p c) = showCG p ++ "#" ++ show c
284+ showCG' (CaseN c) = showCG c ++ "_case"
285285showCG NErased = "_"
286286
287287
src/Idris/AbsSyntax.hs−20
@@ -1361,26 +1361,6 @@ findStatics ist tm = trace (showImp Nothing True False tm) $
13611361 return (PPi p n t sc')
13621362 pos ns ss t = return t
13631363
1364−-- Debugging/logging stuff
1365−
1366−dumpDecls :: [PDecl] -> String
1367−dumpDecls [] = ""
1368−dumpDecls (d:ds) = dumpDecl d ++ "\n" ++ dumpDecls ds
1369−
1370−dumpDecl (PFix _ f ops) = show f ++ " " ++ showSep ", " ops
1371−dumpDecl (PTy _ _ _ _ n t) = "tydecl " ++ show n ++ " : " ++ showImp Nothing True False t
1372−dumpDecl (PClauses _ _ n cs) = "pat " ++ show n ++ "\t" ++ showSep "\n\t" (map (showCImp True) cs)
1373−dumpDecl (PData _ _ _ _ d) = showDImp True d
1374−dumpDecl (PParams _ ns ps) = "params {" ++ show ns ++ "\n" ++ dumpDecls ps ++ "}\n"
1375−dumpDecl (PNamespace n ps) = "namespace {" ++ n ++ "\n" ++ dumpDecls ps ++ "}\n"
1376−dumpDecl (PSyntax _ syn) = "syntax " ++ show syn
1377−dumpDecl (PClass _ _ _ cs n ps ds)
1378− = "class " ++ show cs ++ " " ++ show n ++ " " ++ show ps ++ "\n" ++ dumpDecls ds
1379−dumpDecl (PInstance _ _ cs n _ t _ ds)
1380− = "instance " ++ show cs ++ " " ++ show n ++ " " ++ show t ++ "\n" ++ dumpDecls ds
1381−dumpDecl _ = "..."
1382−-- dumpDecl (PImport i) = "import " ++ i
1383−
13841364-- for 6.12/7 compatibility
13851365data EitherErr a b = LeftErr a | RightOK b
13861366
src/Idris/AbsSyntaxTree.hs+17−7
@@ -869,13 +869,23 @@ instance Show PClause where
869869instance Show PData where
870870 show d = showDImp False d
871871
872+showDecls :: Bool -> [PDecl] -> String
873+showDecls _ [] = ""
874+showDecls i (d:ds) = showDeclImp i d ++ "\n" ++ showDecls i ds
875+
872876showDeclImp _ (PFix _ f ops) = show f ++ " " ++ showSep ", " ops
873−showDeclImp t (PTy _ _ _ _ n ty) = show n ++ " : " ++ showImp Nothing t False ty
874−showDeclImp t (PPostulate _ _ _ _ n ty) = show n ++ " : " ++ showImp Nothing t False ty
875−showDeclImp _ (PClauses _ _ n c) = showSep "\n" (map show c)
876−showDeclImp _ (PData _ _ _ _ d) = show d
877−showDeclImp _ (PParams f ns ps) = "parameters " ++ show ns ++ "\n" ++
878− showSep "\n" (map show ps)
877+showDeclImp i (PTy _ _ _ _ n t) = "tydecl " ++ showCG n ++ " : " ++ showImp Nothing i False t
878+showDeclImp i (PClauses _ _ n cs) = "pat " ++ showCG n ++ "\t" ++ showSep "\n\t" (map (showCImp i) cs)
879+showDeclImp _ (PData _ _ _ _ d) = showDImp True d
880+showDeclImp i (PParams _ ns ps) = "params {" ++ show ns ++ "\n" ++ showDecls i ps ++ "}\n"
881+showDeclImp i (PNamespace n ps) = "namespace {" ++ n ++ "\n" ++ showDecls i ps ++ "}\n"
882+showDeclImp _ (PSyntax _ syn) = "syntax " ++ show syn
883+showDeclImp i (PClass _ _ _ cs n ps ds)
884+ = "class " ++ show cs ++ " " ++ show n ++ " " ++ show ps ++ "\n" ++ showDecls i ds
885+showDeclImp i (PInstance _ _ cs n _ t _ ds)
886+ = "instance " ++ show cs ++ " " ++ show n ++ " " ++ show t ++ "\n" ++ showDecls i ds
887+showDeclImp _ _ = "..."
888+-- showDeclImp (PImport i) = "import " ++ i
879889
880890
881891showCImp :: Bool -> PClause -> String
@@ -1121,7 +1131,7 @@ showName ist bnd impl colour n = case ist of
11211131 Just i -> if colour then colourise n (idris_colourTheme i) else showbasic n
11221132 Nothing -> showbasic n
11231133 where name = if impl then show n else showbasic n
1124− showbasic n@(UN _) = show n
1134+ showbasic n@(UN _) = showCG n
11251135 showbasic (MN _ s) = s
11261136 showbasic (NS n s) = showSep "." (reverse s) ++ "." ++ showbasic n
11271137 showbasic (SN s) = show s
src/Idris/Parser.hs+1−1
@@ -1021,7 +1021,7 @@ loadSource h lidr f
10211021 f file pos
10221022 unless (null ds') $ do
10231023 let ds = namespaces mname ds'
1024− logLvl 3 (dumpDecls ds)
1024+ logLvl 3 (showDecls True ds)
10251025 i <- getIState
10261026 logLvl 10 (show (toAlist (idris_implicits i)))
10271027 logLvl 3 (show (idris_infixes i))
src/Pkg/Package.hs+1−1
@@ -68,7 +68,7 @@ installPkg pkgdesc
6868 mapM_ (installObj (pkgname pkgdesc)) (objs pkgdesc)
6969
7070buildMods :: [Opt] -> [Name] -> IO ()
71−buildMods opts ns = do let f = map (toPath . show) ns
71+buildMods opts ns = do let f = map (toPath . showCG) ns
7272-- putStrLn $ "MODULE: " ++ show f
7373 idris (map Filename f ++ opts)
7474 return ()