projects
/
haskell-directory.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7896793
)
simplify fmap
author
Ross Paterson
<ross@soi.city.ac.uk>
Mon, 6 Feb 2006 09:50:48 +0000
(09:50 +0000)
committer
Ross Paterson
<ross@soi.city.ac.uk>
Mon, 6 Feb 2006 09:50:48 +0000
(09:50 +0000)
Data/Tree.hs
patch
|
blob
|
history
diff --git
a/Data/Tree.hs
b/Data/Tree.hs
index
fec5856
..
bc103b8
100644
(file)
--- a/
Data/Tree.hs
+++ b/
Data/Tree.hs
@@
-64,10
+64,7
@@
type Forest a = [Tree a]
INSTANCE_TYPEABLE1(Tree,treeTc,"Tree")
instance Functor Tree where
- fmap = mapTree
-
-mapTree :: (a -> b) -> (Tree a -> Tree b)
-mapTree f (Node x ts) = Node (f x) (map (mapTree f) ts)
+ fmap f (Node x ts) = Node (f x) (map (fmap f) ts)
instance Traversable Tree where
traverse f (Node x ts) = Node <$> f x <*> traverse (traverse f) ts