projects
/
haskell-directory.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4ad6d47
)
[project @ 2005-07-21 11:08:51 by ross]
author
ross
<unknown>
Thu, 21 Jul 2005 11:08:51 +0000
(11:08 +0000)
committer
ross
<unknown>
Thu, 21 Jul 2005 11:08:51 +0000
(11:08 +0000)
specialize instances too
Data/Sequence.hs
patch
|
blob
|
history
diff --git
a/Data/Sequence.hs
b/Data/Sequence.hs
index
611a0cb
..
4ee0883
100644
(file)
--- a/
Data/Sequence.hs
+++ b/
Data/Sequence.hs
@@
-22,7
+22,7
@@
--
-- * Ralf Hinze and Ross Paterson,
-- \"Finger trees: a simple general-purpose data structure\",
--
-- * Ralf Hinze and Ross Paterson,
-- \"Finger trees: a simple general-purpose data structure\",
--- submitted to /Journal of Functional Programming/.
+-- to appear in /Journal of Functional Programming/.
-- <http://www.soi.city.ac.uk/~ross/papers/FingerTree.html>
--
-- /Note/: Many of these operations have the same names as similar
-- <http://www.soi.city.ac.uk/~ross/papers/FingerTree.html>
--
-- /Note/: Many of these operations have the same names as similar
@@
-177,6
+177,8
@@
data FingerTree a
#endif
instance Sized a => Sized (FingerTree a) where
#endif
instance Sized a => Sized (FingerTree a) where
+ {-# SPECIALIZE instance Sized (FingerTree (Elem a)) #-}
+ {-# SPECIALIZE instance Sized (FingerTree (Node a)) #-}
size Empty = 0
size (Single x) = size x
size (Deep v _ _ _) = v
size Empty = 0
size (Single x) = size x
size (Deep v _ _ _) = v
@@
-211,6
+213,8
@@
instance Functor Digit where
fmap f (Four a b c d) = Four (f a) (f b) (f c) (f d)
instance Sized a => Sized (Digit a) where
fmap f (Four a b c d) = Four (f a) (f b) (f c) (f d)
instance Sized a => Sized (Digit a) where
+ {-# SPECIALIZE instance Sized (Digit (Elem a)) #-}
+ {-# SPECIALIZE instance Sized (Digit (Node a)) #-}
size xs = foldlDigit (\ i x -> i + size x) 0 xs
{-# SPECIALIZE digitToTree :: Digit (Elem a) -> FingerTree (Elem a) #-}
size xs = foldlDigit (\ i x -> i + size x) 0 xs
{-# SPECIALIZE digitToTree :: Digit (Elem a) -> FingerTree (Elem a) #-}