{-# LANGUAGE Safe #-}
module Data.Range.Operators where

import Data.Range.Data

-- | Mathematically equivalent to @[x, y]@.
--
-- @x +=+ y@ is the short version of @SpanRange (Bound x Inclusive) (Bound y Inclusive)@
(+=+) :: a -> a -> Range a
+=+ :: forall a. a -> a -> Range a
(+=+) a
x a
y = Bound a -> Bound a -> Range a
forall a. Bound a -> Bound a -> Range a
SpanRange (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
x BoundType
Inclusive) (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
y BoundType
Inclusive)

-- | Mathematically equivalent to @[x, y)@.
--
-- @x +=* y@ is the short version of @SpanRange (Bound x Inclusive) (Bound y Exclusive)@
(+=*) :: a -> a -> Range a
+=* :: forall a. a -> a -> Range a
(+=*) a
x a
y = Bound a -> Bound a -> Range a
forall a. Bound a -> Bound a -> Range a
SpanRange (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
x BoundType
Inclusive) (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
y BoundType
Exclusive)

-- | Mathematically equivalent to @(x, y]@.
--
-- @x *=+ y@ is the short version of @SpanRange (Bound x Exclusive) (Bound y Inclusive)@
(*=+) :: a -> a -> Range a
*=+ :: forall a. a -> a -> Range a
(*=+) a
x a
y = Bound a -> Bound a -> Range a
forall a. Bound a -> Bound a -> Range a
SpanRange (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
x BoundType
Exclusive) (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
y BoundType
Inclusive)

-- | Mathematically equivalent to @(x, y)@.
--
-- @x *=* y@ is the short version of @SpanRange (Bound x Exclusive) (Bound y Exclusive)@
(*=*) :: a -> a -> Range a
*=* :: forall a. a -> a -> Range a
(*=*) a
x a
y = Bound a -> Bound a -> Range a
forall a. Bound a -> Bound a -> Range a
SpanRange (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
x BoundType
Exclusive) (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
y BoundType
Exclusive)

-- | Mathematically equivalent to @[x, Infinity)@.
--
-- @lbi x@ is the short version of @LowerBoundRange (Bound x Inclusive)@
lbi :: a -> Range a
lbi :: forall a. a -> Range a
lbi a
x = Bound a -> Range a
forall a. Bound a -> Range a
LowerBoundRange (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
x BoundType
Inclusive)

-- | Mathematically equivalent to @(x, Infinity)@.
--
-- @lbe x@ is the short version of @LowerBoundRange (Bound x Exclusive)@
lbe :: a -> Range a
lbe :: forall a. a -> Range a
lbe a
x = Bound a -> Range a
forall a. Bound a -> Range a
LowerBoundRange (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
x BoundType
Exclusive)

-- | Mathematically equivalent to @(Infinity, x]@.
--
-- @ubi x@ is the short version of @UpperBoundRange (Bound x Inclusive)@
ubi :: a -> Range a
ubi :: forall a. a -> Range a
ubi a
x = Bound a -> Range a
forall a. Bound a -> Range a
UpperBoundRange (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
x BoundType
Inclusive)

-- | Mathematically equivalent to @(Infinity, x)@.
--
-- @ube x@ is the short version of @UpperBoundRange (Bound x Exclusive)@
ube :: a -> Range a
ube :: forall a. a -> Range a
ube a
x = Bound a -> Range a
forall a. Bound a -> Range a
UpperBoundRange (a -> BoundType -> Bound a
forall a. a -> BoundType -> Bound a
Bound a
x BoundType
Exclusive)

-- | Shorthand for the `InfiniteRange`
inf :: Range a
inf :: forall a. Range a
inf = Range a
forall a. Range a
InfiniteRange