module Fold.Pure.Examples.Boring
(
null,
magma, semigroup,
first, last,
maximum, minimum, maximumBy, minimumBy,
and, or, all, any,
element, notElement, find, lookup,
index, findIndex, elementIndex,
)
where
import Data.Maybe (Maybe)
import Data.Ord (Ord, Ordering)
import Data.Semigroup (Semigroup)
import Fold.Pure.Type (Fold)
import Data.Bool (Bool)
import Data.Eq (Eq)
import Numeric.Natural (Natural)
import qualified Fold.Pure.Conversion as Convert
import qualified Fold.Nonempty.Examples.Interesting as Nonempty
import qualified Fold.ShortcutNonempty.Examples.Interesting as ShortcutNonempty
import qualified Fold.Shortcut.Examples.Interesting as Shortcut
null :: Fold a Bool
null :: forall a. Fold a Bool
null = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold forall a. ShortcutFold a Bool
Shortcut.null
magma :: (a -> a -> a) -> Fold a (Maybe a)
magma :: forall a. (a -> a -> a) -> Fold a (Maybe a)
magma a -> a -> a
step = forall a b. NonemptyFold a b -> Fold a (Maybe b)
Convert.nonemptyFold (forall a. (a -> a -> a) -> NonemptyFold a a
Nonempty.magma a -> a -> a
step)
semigroup :: Semigroup a => Fold a (Maybe a)
semigroup :: forall a. Semigroup a => Fold a (Maybe a)
semigroup = forall a b. NonemptyFold a b -> Fold a (Maybe b)
Convert.nonemptyFold forall a. Semigroup a => NonemptyFold a a
Nonempty.semigroup
first :: Fold a (Maybe a)
first :: forall a. Fold a (Maybe a)
first = forall a b. ShortcutNonemptyFold a b -> Fold a (Maybe b)
Convert.shortcutNonemptyFold forall a. ShortcutNonemptyFold a a
ShortcutNonempty.first
last :: Fold a (Maybe a)
last :: forall a. Fold a (Maybe a)
last = forall a b. NonemptyFold a b -> Fold a (Maybe b)
Convert.nonemptyFold forall a. NonemptyFold a a
Nonempty.last
maximum :: Ord a => Fold a (Maybe a)
maximum :: forall a. Ord a => Fold a (Maybe a)
maximum = forall a b. NonemptyFold a b -> Fold a (Maybe b)
Convert.nonemptyFold forall a. Ord a => NonemptyFold a a
Nonempty.maximum
maximumBy :: (a -> a -> Ordering) -> Fold a (Maybe a)
maximumBy :: forall a. (a -> a -> Ordering) -> Fold a (Maybe a)
maximumBy a -> a -> Ordering
cmp = forall a b. NonemptyFold a b -> Fold a (Maybe b)
Convert.nonemptyFold (forall a. (a -> a -> Ordering) -> NonemptyFold a a
Nonempty.maximumBy a -> a -> Ordering
cmp)
minimum :: Ord a => Fold a (Maybe a)
minimum :: forall a. Ord a => Fold a (Maybe a)
minimum = forall a b. NonemptyFold a b -> Fold a (Maybe b)
Convert.nonemptyFold forall a. Ord a => NonemptyFold a a
Nonempty.minimum
minimumBy :: (a -> a -> Ordering) -> Fold a (Maybe a)
minimumBy :: forall a. (a -> a -> Ordering) -> Fold a (Maybe a)
minimumBy a -> a -> Ordering
cmp = forall a b. NonemptyFold a b -> Fold a (Maybe b)
Convert.nonemptyFold (forall a. (a -> a -> Ordering) -> NonemptyFold a a
Nonempty.minimumBy a -> a -> Ordering
cmp)
and :: Fold Bool Bool
and :: Fold Bool Bool
and = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold ShortcutFold Bool Bool
Shortcut.and
or :: Fold Bool Bool
or :: Fold Bool Bool
or = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold ShortcutFold Bool Bool
Shortcut.or
all :: (a -> Bool) -> Fold a Bool
all :: forall a. (a -> Bool) -> Fold a Bool
all a -> Bool
predicate = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold (forall a. (a -> Bool) -> ShortcutFold a Bool
Shortcut.all a -> Bool
predicate)
any :: (a -> Bool) -> Fold a Bool
any :: forall a. (a -> Bool) -> Fold a Bool
any a -> Bool
predicate = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold (forall a. (a -> Bool) -> ShortcutFold a Bool
Shortcut.any a -> Bool
predicate)
element :: Eq a => a -> Fold a Bool
element :: forall a. Eq a => a -> Fold a Bool
element a
a = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold (forall a. Eq a => a -> ShortcutFold a Bool
Shortcut.element a
a)
notElement :: Eq a => a -> Fold a Bool
notElement :: forall a. Eq a => a -> Fold a Bool
notElement a
a = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold (forall a. Eq a => a -> ShortcutFold a Bool
Shortcut.notElement a
a)
find :: (a -> Bool) -> Fold a (Maybe a)
find :: forall a. (a -> Bool) -> Fold a (Maybe a)
find a -> Bool
ok = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold (forall a. (a -> Bool) -> ShortcutFold a (Maybe a)
Shortcut.find a -> Bool
ok)
index :: Natural -> Fold a (Maybe a)
index :: forall a. Natural -> Fold a (Maybe a)
index Natural
i = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold (forall a. Natural -> ShortcutFold a (Maybe a)
Shortcut.index Natural
i)
elementIndex :: Eq a => a -> Fold a (Maybe Natural)
elementIndex :: forall a. Eq a => a -> Fold a (Maybe Natural)
elementIndex a
a = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold (forall a. Eq a => a -> ShortcutFold a (Maybe Natural)
Shortcut.elementIndex a
a)
findIndex :: (a -> Bool) -> Fold a (Maybe Natural)
findIndex :: forall a. (a -> Bool) -> Fold a (Maybe Natural)
findIndex a -> Bool
ok = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold (forall a. (a -> Bool) -> ShortcutFold a (Maybe Natural)
Shortcut.findIndex a -> Bool
ok)
lookup :: Eq a => a -> Fold (a, b) (Maybe b)
lookup :: forall a b. Eq a => a -> Fold (a, b) (Maybe b)
lookup a
a0 = forall a b. ShortcutFold a b -> Fold a b
Convert.shortcutFold (forall a b. Eq a => a -> ShortcutFold (a, b) (Maybe b)
Shortcut.lookup a
a0)