diff --git a/app/GraphAlgorithms.hs b/app/GraphAlgorithms.hs index 47f4467..f2a33a1 100644 --- a/app/GraphAlgorithms.hs +++ b/app/GraphAlgorithms.hs @@ -46,7 +46,7 @@ parentTypeForNode n = case n of PatternApplyNode _ _ -> PatternParent -- The NotAParent case should never occur. _ -> NotAParent - + findParents :: ING.Graph gr => IngSyntaxGraph gr -> ING.Node -> [ING.Node] findParents graph node = filter parentFilter $ ING.suc graph node where parentFilter parentNode = parentNode /= node diff --git a/app/Main.hs b/app/Main.hs index 0ee8b95..0f0c027 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -6,6 +6,7 @@ import Prelude hiding (return) -- - an special case when translating when Glance is run on its own source code. import Diagrams.Prelude hiding ((#), (&)) import Diagrams.Backend.SVG.CmdLine +--import Diagrams.Backend.Rasterific.CmdLine import qualified Language.Haskell.Exts as Exts import Icons(ColorStyle(..), colorScheme, multilineComment) diff --git a/app/Translate.hs b/app/Translate.hs index a8552db..e7372cc 100644 --- a/app/Translate.hs +++ b/app/Translate.hs @@ -499,6 +499,7 @@ drawingFromDecl d = drawing evaluatedDecl = evalDecl mempty d >>= showTopLevelBinds syntaxGraph = evalState evaluatedDecl initialIdState drawing = collapseNodes $ syntaxGraphToFglGraph syntaxGraph + --drawing = syntaxGraphToFglGraph syntaxGraph -- Profiling: about 1.5% of total time. translateString :: String -> (IngSyntaxGraph FGR.Gr, Decl) diff --git a/glance.cabal b/glance.cabal index 7aae09f..1ef6581 100644 --- a/glance.cabal +++ b/glance.cabal @@ -36,6 +36,7 @@ executable glance-exe , haskell-src-exts , mtl , semigroups + , diagrams-rasterific default-language: Haskell2010 Other-modules: Icons, Rendering, Types, Util, Translate, TranslateCore, DrawingColors, GraphAlgorithms diff --git a/test/AllTests.hs b/test/AllTests.hs index dc7244e..63eae51 100644 --- a/test/AllTests.hs +++ b/test/AllTests.hs @@ -236,7 +236,8 @@ nestedTests = [ "Foo (Bar x) = 1", "Foo (Bar x) (Baz y) = 1", "Foo (Bar x) = f 2", - "Foo (Bar x) = f x" + "Foo (Bar x) = f x", + "y x = case x of {Just w -> (let (z,_) = w in z)}" ] dollarTests :: [String] @@ -519,7 +520,8 @@ collapseTestStrings = [ "Foo x = 1", "Foo (Bar x) = 1", "Foo 1 x = 2", - "Foo (Bar x) = f x" + "Foo (Bar x) = f x", + "y x = case x of {Just w -> (let (z,_) = w in z)}" ] makeCollapseTest :: String -> IO (Diagram B) diff --git a/todo.txt b/todo.txt index 5e8ccb5..0e098ce 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,6 @@ -- TODO Now -- +Fix collapseNodes when run on "y x = case x of {Just w -> (let (z,_) = w in z)}" +May need to move pattern collapse to translate. -- TODO Later -- -- Add documentation.