on master help sign in
Replace partial `showDeclImp` function with total `dumpDecl`

Remove original `dumpDecl` and replace call to `dumpDecls` with call to `showDecls True`.

commit232a592e1451f19b17b1acf96f90d84f08858258 authorBrian McKenna <brian@brianmckenna.org> dateFri 29 Nov 2013, 18:37 (13 years ago) parenta0b21e3
3 files changed+17−27
src/Idris/AbsSyntax.hs−20 src/Idris/AbsSyntaxTree.hs+16−6 src/Idris/Parser.hs+1−1
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+16−6
@@ -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
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))