diff options
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/OrdList.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/utils/OrdList.hs b/compiler/utils/OrdList.hs index 625886d0a7..3c5b9d7380 100644 --- a/compiler/utils/OrdList.hs +++ b/compiler/utils/OrdList.hs @@ -49,6 +49,15 @@ instance Monoid (OrdList a) where mappend = appOL mconcat = concatOL +instance Functor OrdList where + fmap = mapOL + +instance Foldable OrdList where + foldr = foldrOL + +instance Traversable OrdList where + traverse f xs = toOL <$> traverse f (fromOL xs) + nilOL :: OrdList a isNilOL :: OrdList a -> Bool @@ -98,9 +107,6 @@ mapOL f (Snoc xs x) = Snoc (mapOL f xs) (f x) mapOL f (Two x y) = Two (mapOL f x) (mapOL f y) mapOL f (Many xs) = Many (map f xs) -instance Functor OrdList where - fmap = mapOL - foldrOL :: (a->b->b) -> b -> OrdList a -> b foldrOL _ z None = z foldrOL k z (One x) = k x z |