File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import Prelude
18
18
import Control.Extend (class Extend )
19
19
import Data.Bifunctor (class Bifunctor , bimap )
20
20
import Data.Foldable (class Foldable , foldrDefault , foldMapDefaultL )
21
+ import Data.Bifoldable (class Bifoldable , bifoldrDefault , bifoldMapDefaultL )
21
22
import Data.List (List (..), (:))
22
23
import Data.Maybe (Maybe )
23
24
import Data.Monoid (class Monoid , mempty )
@@ -56,6 +57,14 @@ instance foldableInterval ∷ Foldable (Interval d) where
56
57
foldr x = foldrDefault x
57
58
foldMap = foldMapDefaultL
58
59
60
+ instance bifoldableInterval ∷ Bifoldable Interval where
61
+ bifoldl _ f z (StartEnd x y) = (z `f` x) `f` y
62
+ bifoldl g f z (DurationEnd d x) = (z `g` d) `f` x
63
+ bifoldl g f z (StartDuration x d) = (z `g` d) `f` x
64
+ bifoldl g _ z (JustDuration d) = z `g` d
65
+ bifoldr x = bifoldrDefault x
66
+ bifoldMap = bifoldMapDefaultL
67
+
59
68
instance traversableInterval ∷ Traversable (Interval d ) where
60
69
traverse f (StartEnd x y) = StartEnd <$> f x <*> f y
61
70
traverse f (DurationEnd d x) = f x <#> DurationEnd d
You can’t perform that action at this time.
0 commit comments