Put the function name in nested apply and pattern apply in a colored box.

This commit is contained in:
Robbie Gleichman 2016-12-09 00:42:53 -08:00
parent c8649945c3
commit 540c864f25
3 changed files with 8 additions and 10 deletions

View File

@ -219,13 +219,13 @@ generalNestedDia dia borderCols funcNodeNameAndArgs name nestingLevel reflect an
borderCol = borderCols !! nestingLevel
makeQualifiedPort x = name .>> makePort x
transformedText = case maybeFunText of
Just _ -> makeInnerIcon nestingLevel 0 maybeFunText
Just _ -> makeInnerIcon True 0 maybeFunText
Nothing -> mempty
seperation = circleRadius * 1.5
verticalSeperation = circleRadius
trianglePortsCircle = hsep seperation $
reflectX (dia borderCol) :
zipWith (makeInnerIcon $ nestingLevel + 1) [2,3..] args ++
zipWith (makeInnerIcon False) [2,3..] args ++
[makeQualifiedPort (Port 1) <> alignR (lc borderCol $ lwG defaultLineWidth $ fc borderCol $ circle circleRadius)]
allPorts = makeQualifiedPort (Port 0) <> alignL trianglePortsCircle
@ -234,7 +234,9 @@ generalNestedDia dia borderCols funcNodeNameAndArgs name nestingLevel reflect an
finalDia = argBox <> allPorts
makeInnerIcon _ portNum Nothing = makeQualifiedPort (Port portNum) <> portCircle
makeInnerIcon innerLevel _ (Just (iconNodeName, icon)) = iconToDiagram icon iconNodeName innerLevel reflect angle
makeInnerIcon True _ (Just (_, TextBoxIcon t)) = transformCorrectedTextBox t (textBoxTextC colorScheme) borderCol reflect angle
makeInnerIcon func _ (Just (iconNodeName, icon)) = iconToDiagram icon iconNodeName innerLevel reflect angle where
innerLevel = if func then nestingLevel else nestingLevel + 1
-- TEXT ICON --

View File

@ -197,8 +197,8 @@ y = (((2 + 4 * 4) - (7+ 2 + baz)*8)/21)
{-
Since constructors are functions, the match icon has the same shape as
the apply icon. The match icon is magenta with blue text to help distinguish
them from the apply icon. In a future iteration of the Glance icons, the match and
the apply icon. The match icon is magenta to help distinguish
it from the apply icon. In a future iteration of the Glance icons, the match and
apply icons should be made more dissimilar so that they can not be confused with
each other, even when displaying Glance drawings in black and white.

View File

@ -1,6 +1,5 @@
-- TODO Now --
Add compose to the tutorial.
-- Put the function name in nested apply and pattern apply in a colored box.
-- TODO Later --
-- Add documentation.
@ -9,8 +8,6 @@ Add compose to the tutorial.
Fix the arrowheads being too big for SyntaxGraph darwings.
-- Visual todos:
Fix edges overlapping making it hard to match up the ends of the edges. Different edge colors for each source might fix this.
-- Make an icon font/library with labeled ports. E.g. the apply icon would have text labels "function", "result", "arg 0", "arg 1", etc.
-- Don't rotate text and nested icons, give them rectangualar bounding boxes in GraphViz. (Perhaps use a typeclass for isRotateAble)
-- Give lines a black border to make line crossings easier to see.
@ -19,8 +16,7 @@ Fix edges overlapping making it hard to match up the ends of the edges. Differen
-- a line ending.
-- Let each bool, value pair in Guard icon be flipped to reduce line crossings. Do the same for case.
-- Let lines connect to ports in multiple locations (eg. case value, or guard result)
-- For nested apply, cycle through different colors and line styles (eg. dashed, solid, wavy)
-- - for each nesting level. This will help distinguish what is an argument to which funciton.
-- Use different line styles (eg. dashed, solid, wavy) in addition to colors
-- Translate todos: