{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE FlexibleInstances #-}
module IntervalAlgebra.IntervalUtilities (
combineIntervals
, combineIntervals'
, gaps
, gaps'
, durations
, clip
, relations
, relations'
, gapsWithin
, nothingIf
, nothingIfNone
, nothingIfAny
, nothingIfAll
, filterBefore
, filterMeets
, filterOverlaps
, filterFinishedBy
, filterContains
, filterStarts
, filterEquals
, filterStartedBy
, filterDuring
, filterFinishes
, filterOverlappedBy
, filterMetBy
, filterAfter
, filterDisjoint
, filterNotDisjoint
, filterWithin
) where
import GHC.Base
( otherwise, ($), (.), (<*>), seq, not
, Semigroup((<>))
, Functor(fmap)
, Applicative(pure)
, Int, Bool)
import GHC.Num ()
import Data.Tuple ( fst )
import Data.Foldable ( Foldable(null, foldl', toList), all, any )
import Data.Monoid ( (<>), Monoid(mempty) )
import IntervalAlgebra
( Interval, Intervallic(..), IntervalAlgebraic(..)
, IntervalCombinable(..), IntervalSizeable(..)
, IntervalRelation(..)
, ComparativePredicateOf)
import Data.Maybe (mapMaybe, catMaybes, fromMaybe, Maybe(..))
import Data.List ( (++), map, head, init, last, tail )
import Witherable ( Filterable(filter) )
intInt :: Int -> Int -> Interval Int
intInt :: Int -> Int -> Interval Int
intInt = Int -> Int -> Interval Int
forall a. Intervallic a => a -> a -> Interval a
unsafeInterval
foldlAccume :: (Foldable f, Applicative m, Monoid (m a))=>
(b -> b -> a)
-> f b
-> m a
foldlAccume :: (b -> b -> a) -> f b -> m a
foldlAccume b -> b -> a
f f b
x = (m a, Maybe b) -> m a
forall a b. (a, b) -> a
fst ((m a, Maybe b) -> m a) -> (m a, Maybe b) -> m a
forall a b. (a -> b) -> a -> b
$ ((m a, Maybe b) -> b -> (m a, Maybe b))
-> (m a, Maybe b) -> f b -> (m a, Maybe b)
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' ((b -> b -> a) -> (m a, Maybe b) -> b -> (m a, Maybe b)
forall (f :: * -> *) a b.
(Monoid (f a), Applicative f) =>
(b -> b -> a) -> (f a, Maybe b) -> b -> (f a, Maybe b)
applyAccume b -> b -> a
f) (m a
forall a. Monoid a => a
mempty, Maybe b
forall a. Maybe a
Nothing) f b
x
applyAccume :: (Monoid (f a), Applicative f) =>
(b -> b -> a)
-> (f a, Maybe b)
-> b
-> (f a, Maybe b)
applyAccume :: (b -> b -> a) -> (f a, Maybe b) -> b -> (f a, Maybe b)
applyAccume b -> b -> a
f (f a
fs, Maybe b
Nothing) b
x = (f a
fs, b -> Maybe b
forall a. a -> Maybe a
Just b
x)
applyAccume b -> b -> a
f (f a
fs, Just b
x) b
y = (f a
fs f a -> f a -> f a
forall a. Semigroup a => a -> a -> a
<> a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (b -> b -> a
f b
x b
y), b -> Maybe b
forall a. a -> Maybe a
Just b
y)
liftListToFoldable :: (Applicative f
, Monoid (f a)
, Foldable f) =>
[a] -> f a
liftListToFoldable :: [a] -> f a
liftListToFoldable = (f a -> a -> f a) -> f a -> [a] -> f a
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (\f a
x a
y -> f a
x f a -> f a -> f a
forall a. Semigroup a => a -> a -> a
<> a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
y) f a
forall a. Monoid a => a
mempty
newtype Box a = Box { Box a -> [a]
unBox :: [a] }
instance (IntervalCombinable a) => Semigroup (Box (Interval a)) where
Box [Interval a]
x <> :: Box (Interval a) -> Box (Interval a) -> Box (Interval a)
<> Box [Interval a]
y
| [Interval a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Interval a]
x = [Interval a] -> Box (Interval a)
forall a. [a] -> Box a
Box [Interval a]
y
| [Interval a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Interval a]
y = [Interval a] -> Box (Interval a)
forall a. [a] -> Box a
Box [Interval a]
x
| Bool
otherwise = [Interval a] -> Box (Interval a)
forall a. [a] -> Box a
Box ([Interval a] -> Box (Interval a))
-> [Interval a] -> Box (Interval a)
forall a b. (a -> b) -> a -> b
$ [Interval a] -> [Interval a]
forall a. [a] -> [a]
init [Interval a]
x [Interval a] -> [Interval a] -> [Interval a]
forall a. [a] -> [a] -> [a]
++ (Interval a
lx Interval a -> Interval a -> [Interval a]
forall a (f :: * -> *).
(IntervalCombinable a, Semigroup (f (Interval a)),
Applicative f) =>
Interval a -> Interval a -> f (Interval a)
<+> Interval a
fy) [Interval a] -> [Interval a] -> [Interval a]
forall a. [a] -> [a] -> [a]
++ [Interval a] -> [Interval a]
forall a. [a] -> [a]
tail [Interval a]
y
where lx :: Interval a
lx = [Interval a] -> Interval a
forall a. [a] -> a
last [Interval a]
x
fy :: Interval a
fy = [Interval a] -> Interval a
forall a. [a] -> a
head [Interval a]
y
combineIntervals :: (IntervalCombinable a
, Applicative f
, Monoid (f (Interval a))
, Foldable f) =>
f (Interval a) ->
f (Interval a)
combineIntervals :: f (Interval a) -> f (Interval a)
combineIntervals f (Interval a)
x = [Interval a] -> f (Interval a)
forall (f :: * -> *) a.
(Applicative f, Monoid (f a), Foldable f) =>
[a] -> f a
liftListToFoldable ([Interval a] -> [Interval a]
forall a. IntervalCombinable a => [Interval a] -> [Interval a]
combineIntervals' ([Interval a] -> [Interval a]) -> [Interval a] -> [Interval a]
forall a b. (a -> b) -> a -> b
$ f (Interval a) -> [Interval a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList f (Interval a)
x)
combineIntervals' :: (IntervalCombinable a) => [Interval a] -> [Interval a]
combineIntervals' :: [Interval a] -> [Interval a]
combineIntervals' [Interval a]
l = Box (Interval a) -> [Interval a]
forall a. Box a -> [a]
unBox (Box (Interval a) -> [Interval a])
-> Box (Interval a) -> [Interval a]
forall a b. (a -> b) -> a -> b
$ (Box (Interval a) -> Box (Interval a) -> Box (Interval a))
-> Box (Interval a) -> [Box (Interval a)] -> Box (Interval a)
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' Box (Interval a) -> Box (Interval a) -> Box (Interval a)
forall a. Semigroup a => a -> a -> a
(<>) ([Interval a] -> Box (Interval a)
forall a. [a] -> Box a
Box []) ((Interval a -> Box (Interval a))
-> [Interval a] -> [Box (Interval a)]
forall a b. (a -> b) -> [a] -> [b]
map (\Interval a
z -> [Interval a] -> Box (Interval a)
forall a. [a] -> Box a
Box [Interval a
z]) [Interval a]
l)
gaps :: (IntervalCombinable a
, Applicative f
, Monoid (f (Interval a))
, Foldable f) =>
f (Interval a) ->
f (Interval a)
gaps :: f (Interval a) -> f (Interval a)
gaps f (Interval a)
x = [Interval a] -> f (Interval a)
forall (f :: * -> *) a.
(Applicative f, Monoid (f a), Foldable f) =>
[a] -> f a
liftListToFoldable (f (Interval a) -> [Interval a]
forall a (f :: * -> *).
(IntervalCombinable a, Applicative f, Monoid (f (Interval a)),
Foldable f) =>
f (Interval a) -> [Interval a]
gaps' f (Interval a)
x)
gaps' :: (IntervalCombinable a
, Applicative f
, Monoid (f (Interval a))
, Foldable f) =>
f (Interval a) ->
[Interval a]
gaps' :: f (Interval a) -> [Interval a]
gaps' f (Interval a)
x = [Maybe (Interval a)] -> [Interval a]
forall a. [Maybe a] -> [a]
catMaybes ((Interval a -> Interval a -> Maybe (Interval a))
-> f (Interval a) -> [Maybe (Interval a)]
forall (f :: * -> *) (m :: * -> *) a b.
(Foldable f, Applicative m, Monoid (m a)) =>
(b -> b -> a) -> f b -> m a
foldlAccume Interval a -> Interval a -> Maybe (Interval a)
forall a.
IntervalCombinable a =>
Interval a -> Interval a -> Maybe (Interval a)
(><) f (Interval a)
x)
durations :: (Functor f, IntervalSizeable a b)=>
f (Interval a)
-> f b
durations :: f (Interval a) -> f b
durations = (Interval a -> b) -> f (Interval a) -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Interval a -> b
forall a b. IntervalSizeable a b => Interval a -> b
duration
clip :: (IntervalAlgebraic a, IntervalSizeable a b)=>
Interval a
-> Interval a
-> Maybe (Interval a)
clip :: Interval a -> Interval a -> Maybe (Interval a)
clip Interval a
x Interval a
y
| ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
overlaps Interval a
x Interval a
y = Interval a -> Maybe (Interval a)
forall a. a -> Maybe a
Just (Interval a -> Maybe (Interval a))
-> Interval a -> Maybe (Interval a)
forall a b. (a -> b) -> a -> b
$ b -> a -> Interval a
forall a b. IntervalSizeable a b => b -> a -> Interval a
enderval (a -> a -> b
forall a b. IntervalSizeable a b => a -> a -> b
diff (Interval a -> a
forall a. Intervallic a => Interval a -> a
end Interval a
x) (Interval a -> a
forall a. Intervallic a => Interval a -> a
begin Interval a
y)) (Interval a -> a
forall a. Intervallic a => Interval a -> a
end Interval a
x)
| ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
overlappedBy Interval a
x Interval a
y = Interval a -> Maybe (Interval a)
forall a. a -> Maybe a
Just (Interval a -> Maybe (Interval a))
-> Interval a -> Maybe (Interval a)
forall a b. (a -> b) -> a -> b
$ b -> a -> Interval a
forall a b. IntervalSizeable a b => b -> a -> Interval a
beginerval (a -> a -> b
forall a b. IntervalSizeable a b => a -> a -> b
diff (Interval a -> a
forall a. Intervallic a => Interval a -> a
end Interval a
y) (Interval a -> a
forall a. Intervallic a => Interval a -> a
begin Interval a
x)) (Interval a -> a
forall a. Intervallic a => Interval a -> a
begin Interval a
x)
| ComparativePredicateOf (Interval a)
jx Interval a
x Interval a
y = Interval a -> Maybe (Interval a)
forall a. a -> Maybe a
Just Interval a
x
| ComparativePredicateOf (Interval a)
jy Interval a
x Interval a
y = Interval a -> Maybe (Interval a)
forall a. a -> Maybe a
Just Interval a
y
| ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
disjoint Interval a
x Interval a
y = Maybe (Interval a)
forall a. Maybe a
Nothing
where jy :: ComparativePredicateOf (Interval a)
jy = ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
equals ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
<|> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
startedBy ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
<|> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
contains ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
<|> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
finishedBy
jx :: ComparativePredicateOf (Interval a)
jx = ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
starts ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
<|> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
during ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
-> ComparativePredicateOf (Interval a)
<|> ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
finishes
relations :: (IntervalAlgebraic a, Foldable f)=>
f (Interval a)
-> [IntervalRelation a]
relations :: f (Interval a) -> [IntervalRelation a]
relations = f (Interval a) -> [IntervalRelation a]
forall a (f :: * -> *) (m :: * -> *).
(IntervalAlgebraic a, Foldable f, Applicative m,
Monoid (m (IntervalRelation a))) =>
f (Interval a) -> m (IntervalRelation a)
relations'
relations' :: ( IntervalAlgebraic a
, Foldable f
, Applicative m
, Monoid (m (IntervalRelation a)) )=>
f (Interval a)
-> m (IntervalRelation a)
relations' :: f (Interval a) -> m (IntervalRelation a)
relations' = (Interval a -> Interval a -> IntervalRelation a)
-> f (Interval a) -> m (IntervalRelation a)
forall (f :: * -> *) (m :: * -> *) a b.
(Foldable f, Applicative m, Monoid (m a)) =>
(b -> b -> a) -> f b -> m a
foldlAccume Interval a -> Interval a -> IntervalRelation a
forall a.
IntervalAlgebraic a =>
Interval a -> Interval a -> IntervalRelation a
relate
gapsWithin :: ( Applicative f
, Foldable f
, Monoid (f (Interval a))
, IntervalSizeable a b
, IntervalCombinable a
, Filterable f
, IntervalAlgebraic a)=>
Interval a
-> f (Interval a)
-> Maybe (f (Interval a))
gapsWithin :: Interval a -> f (Interval a) -> Maybe (f (Interval a))
gapsWithin Interval a
i f (Interval a)
x
| f (Interval a) -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null f (Interval a)
ivs = Maybe (f (Interval a))
forall a. Maybe a
Nothing
| Bool
otherwise = f (Interval a) -> Maybe (f (Interval a))
forall a. a -> Maybe a
Just (f (Interval a) -> Maybe (f (Interval a)))
-> f (Interval a) -> Maybe (f (Interval a))
forall a b. (a -> b) -> a -> b
$ f (Interval a) -> f (Interval a)
forall a (f :: * -> *).
(IntervalCombinable a, Applicative f, Monoid (f (Interval a)),
Foldable f) =>
f (Interval a) -> f (Interval a)
gaps (f (Interval a) -> f (Interval a))
-> f (Interval a) -> f (Interval a)
forall a b. (a -> b) -> a -> b
$ Interval a -> f (Interval a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Interval a
s f (Interval a) -> f (Interval a) -> f (Interval a)
forall a. Semigroup a => a -> a -> a
<> f (Interval a)
ivs f (Interval a) -> f (Interval a) -> f (Interval a)
forall a. Semigroup a => a -> a -> a
<> Interval a -> f (Interval a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Interval a
e
where s :: Interval a
s = b -> a -> Interval a
forall a b. IntervalSizeable a b => b -> a -> Interval a
enderval b
0 (Interval a -> a
forall a. Intervallic a => Interval a -> a
begin Interval a
i)
e :: Interval a
e = b -> a -> Interval a
forall a b. IntervalSizeable a b => b -> a -> Interval a
beginerval b
0 (Interval a -> a
forall a. Intervallic a => Interval a -> a
end Interval a
i)
nd :: [Interval a]
nd = f (Interval a) -> [Interval a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterNotDisjoint Interval a
i f (Interval a)
x)
ivs :: f (Interval a)
ivs = [Interval a] -> f (Interval a)
forall (f :: * -> *) a.
(Applicative f, Monoid (f a), Foldable f) =>
[a] -> f a
liftListToFoldable ((Interval a -> Maybe (Interval a)) -> [Interval a] -> [Interval a]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Interval a -> Interval a -> Maybe (Interval a)
forall a b.
(IntervalAlgebraic a, IntervalSizeable a b) =>
Interval a -> Interval a -> Maybe (Interval a)
clip Interval a
i) [Interval a]
nd)
nothingIf :: (Monoid (f (Interval a)), Filterable f, IntervalAlgebraic a)=>
((Interval a -> Bool) -> f (Interval a) -> Bool)
-> (Interval a -> Bool)
-> f (Interval a)
-> Maybe (f (Interval a))
nothingIf :: ((Interval a -> Bool) -> f (Interval a) -> Bool)
-> (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
nothingIf (Interval a -> Bool) -> f (Interval a) -> Bool
quantifier Interval a -> Bool
predicate f (Interval a)
x = if (Interval a -> Bool) -> f (Interval a) -> Bool
quantifier Interval a -> Bool
predicate f (Interval a)
x then Maybe (f (Interval a))
forall a. Maybe a
Nothing else f (Interval a) -> Maybe (f (Interval a))
forall a. a -> Maybe a
Just f (Interval a)
x
nothingIfNone :: (Monoid (f (Interval a)), Foldable f, Filterable f, IntervalAlgebraic a)=>
(Interval a -> Bool)
-> f (Interval a)
-> Maybe (f (Interval a))
nothingIfNone :: (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
nothingIfNone = ((Interval a -> Bool) -> f (Interval a) -> Bool)
-> (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
forall (f :: * -> *) a.
(Monoid (f (Interval a)), Filterable f, IntervalAlgebraic a) =>
((Interval a -> Bool) -> f (Interval a) -> Bool)
-> (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
nothingIf (\Interval a -> Bool
f f (Interval a)
x -> (Bool -> Bool
not(Bool -> Bool)
-> (f (Interval a) -> Bool) -> f (Interval a) -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Interval a -> Bool) -> f (Interval a) -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Interval a -> Bool
f) f (Interval a)
x)
nothingIfAny :: (Monoid (f (Interval a)), Foldable f, Filterable f, IntervalAlgebraic a)=>
(Interval a -> Bool)
-> f (Interval a)
-> Maybe (f (Interval a))
nothingIfAny :: (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
nothingIfAny = ((Interval a -> Bool) -> f (Interval a) -> Bool)
-> (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
forall (f :: * -> *) a.
(Monoid (f (Interval a)), Filterable f, IntervalAlgebraic a) =>
((Interval a -> Bool) -> f (Interval a) -> Bool)
-> (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
nothingIf (Interval a -> Bool) -> f (Interval a) -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any
nothingIfAll :: (Monoid (f (Interval a)), Foldable f, Filterable f, IntervalAlgebraic a)=>
(Interval a -> Bool)
-> f (Interval a)
-> Maybe (f (Interval a))
nothingIfAll :: (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
nothingIfAll = ((Interval a -> Bool) -> f (Interval a) -> Bool)
-> (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
forall (f :: * -> *) a.
(Monoid (f (Interval a)), Filterable f, IntervalAlgebraic a) =>
((Interval a -> Bool) -> f (Interval a) -> Bool)
-> (Interval a -> Bool) -> f (Interval a) -> Maybe (f (Interval a))
nothingIf (Interval a -> Bool) -> f (Interval a) -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all
filterMaker :: (Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a
-> (f (Interval a) -> f (Interval a))
filterMaker :: ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
f Interval a
p = (Interval a -> Bool) -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a. Filterable f => (a -> Bool) -> f a -> f a
Witherable.filter (ComparativePredicateOf (Interval a)
`f` Interval a
p)
filterOverlaps :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterOverlaps :: Interval a -> f (Interval a) -> f (Interval a)
filterOverlaps = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
overlaps
filterOverlappedBy :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterOverlappedBy :: Interval a -> f (Interval a) -> f (Interval a)
filterOverlappedBy = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
overlappedBy
filterBefore :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterBefore :: Interval a -> f (Interval a) -> f (Interval a)
filterBefore = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
before
filterAfter :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterAfter :: Interval a -> f (Interval a) -> f (Interval a)
filterAfter = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
after
filterStarts :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterStarts :: Interval a -> f (Interval a) -> f (Interval a)
filterStarts = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
starts
filterStartedBy :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterStartedBy :: Interval a -> f (Interval a) -> f (Interval a)
filterStartedBy = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
startedBy
filterFinishes :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterFinishes :: Interval a -> f (Interval a) -> f (Interval a)
filterFinishes = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
finishes
filterFinishedBy :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterFinishedBy :: Interval a -> f (Interval a) -> f (Interval a)
filterFinishedBy = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
finishedBy
filterMeets :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterMeets :: Interval a -> f (Interval a) -> f (Interval a)
filterMeets = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
meets
filterMetBy :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterMetBy :: Interval a -> f (Interval a) -> f (Interval a)
filterMetBy = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
metBy
filterDuring :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterDuring :: Interval a -> f (Interval a) -> f (Interval a)
filterDuring = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
during
filterContains :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterContains :: Interval a -> f (Interval a) -> f (Interval a)
filterContains = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
contains
filterEquals :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterEquals :: Interval a -> f (Interval a) -> f (Interval a)
filterEquals = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
equals
filterDisjoint :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterDisjoint :: Interval a -> f (Interval a) -> f (Interval a)
filterDisjoint = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
disjoint
filterNotDisjoint :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterNotDisjoint :: Interval a -> f (Interval a) -> f (Interval a)
filterNotDisjoint = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
notDisjoint
filterWithin :: (Filterable f, IntervalAlgebraic a) =>
Interval a -> f (Interval a) -> f (Interval a)
filterWithin :: Interval a -> f (Interval a) -> f (Interval a)
filterWithin = ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
forall (f :: * -> *) a.
(Filterable f, IntervalAlgebraic a) =>
ComparativePredicateOf (Interval a)
-> Interval a -> f (Interval a) -> f (Interval a)
filterMaker ComparativePredicateOf (Interval a)
forall a.
IntervalAlgebraic a =>
ComparativePredicateOf (Interval a)
disjoint