chiark
/
gitweb
/
~mdw
/
fringe
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
haskell: Remove some redundant parenthesis.
[fringe]
/
haskell-fringe.hs
diff --git
a/haskell-fringe.hs
b/haskell-fringe.hs
index 78c636203133a38ff6ef4e41b2948dfbb313cb0d..4ca9a3eb6b72976f11330a312e2adabcbf7b4b8b 100644
(file)
--- a/
haskell-fringe.hs
+++ b/
haskell-fringe.hs
@@
-58,12
+58,12
@@
eof = do
-----------------------------------------------------------------------------
-- Tree data type.
-----------------------------------------------------------------------------
-- Tree data type.
-data Tree a = Leaf | Node (Tree a
, a,
Tree a) deriving (Show)
+data Tree a = Leaf | Node (Tree a
) a (
Tree a) deriving (Show)
-- Return the elements inorder, as a list.
fringe t = gather t [] where
gather Leaf ns = ns
-- Return the elements inorder, as a list.
fringe t = gather t [] where
gather Leaf ns = ns
- gather (Node
(l, x, r)
) ns = gather l (x : gather r ns)
+ gather (Node
l x r
) ns = gather l (x : gather r ns)
-- Answer whether two trees have the same fringe.
sameFringe t tt = fringe t == fringe tt -- trivial!
-- Answer whether two trees have the same fringe.
sameFringe t tt = fringe t == fringe tt -- trivial!
@@
-81,7
+81,7
@@
parseTree cs = parse cs $ do t <- tree; eof; return t
case r of
Just '(' -> do
step; left <- tree; c <- anytok "no data"; right <- tree; delim ')'
case r of
Just '(' -> do
step; left <- tree; c <- anytok "no data"; right <- tree; delim ')'
- return $ Node
(left, c, right)
+ return $ Node
left c right
_ -> return Leaf
-----------------------------------------------------------------------------
_ -> return Leaf
-----------------------------------------------------------------------------