mono-traversable-0.6.0.4: Type classes for mapping, folding, and traversing monomorphic containers

Safe HaskellNone

Data.MinLen

Contents

Synopsis

Type level naturals

data Zero Source

Constructors

Zero 

Instances

data Succ nat Source

Constructors

Succ nat 

Instances

TypeNat nat => TypeNat (Succ nat) 
MonoPointed mono => MonoPointed (MinLen (Succ Zero) mono) 

class TypeNat nat whereSource

Methods

toValueNat :: Num i => nat -> iSource

typeNat :: natSource

Instances

TypeNat Zero 
TypeNat nat => TypeNat (Succ nat) 

type family AddNat x y Source

type family MaxNat x y Source

Minimum length newtype wrapper

data MinLen nat mono Source

Instances

Typeable2 MinLen 
Functor (MinLen nat) 
Eq mono => Eq (MinLen nat mono) 
(Data nat, Data mono) => Data (MinLen nat mono) 
Ord mono => Ord (MinLen nat mono) 
Read mono => Read (MinLen nat mono) 
Show mono => Show (MinLen nat mono) 
GrowingAppend mono => Semigroup (MinLen nat mono) 
MonoPointed mono => MonoPointed (MinLen (Succ Zero) mono) 
MonoPointed mono => MonoPointed (MinLen Zero mono) 
MonoTraversable mono => MonoTraversable (MinLen nat mono) 
MonoFoldableOrd mono => MonoFoldableOrd (MinLen nat mono) 
MonoFoldable mono => MonoFoldable (MinLen nat mono) 
MonoFunctor mono => MonoFunctor (MinLen nat mono) 
GrowingAppend mono => GrowingAppend (MinLen nat mono) 
SemiSequence seq => SemiSequence (MinLen nat seq) 

unMinLen :: MinLen nat mono -> monoSource

toMinLen :: (MonoFoldable mono, TypeNat nat) => mono -> Maybe (MinLen nat mono)Source

unsafeToMinLen :: mono -> MinLen nat monoSource

Although this function itself cannot cause a segfault, it breaks the safety guarantees of MinLen and can lead to a segfault when using otherwise safe functions.

mlcons :: IsSequence seq => Element seq -> MinLen nat seq -> MinLen (Succ nat) seqSource

mlappend :: IsSequence seq => MinLen x seq -> MinLen y seq -> MinLen (AddNat x y) seqSource

mlunion :: GrowingAppend mono => MinLen x mono -> MinLen y mono -> MinLen (MaxNat x y) monoSource

head :: MonoTraversable mono => MinLen (Succ nat) mono -> Element monoSource

last :: MonoTraversable mono => MinLen (Succ nat) mono -> Element monoSource

tailML :: IsSequence seq => MinLen (Succ nat) seq -> MinLen nat seqSource

initML :: IsSequence seq => MinLen (Succ nat) seq -> MinLen nat seqSource

ofoldMap1 :: (MonoFoldable mono, Semigroup m) => (Element mono -> m) -> MinLen (Succ nat) mono -> mSource

ofold1 :: (MonoFoldable mono, Semigroup (Element mono)) => MinLen (Succ nat) mono -> Element monoSource

ofoldr1 :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> MinLen (Succ nat) mono -> Element monoSource

ofoldl1' :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> MinLen (Succ nat) mono -> Element monoSource

A variant of 'ofoldl\'' that has no base case, and thus may only be applied to non-empty structures.

'foldl1\'' f = foldl1 f . otoList

maximum :: MonoFoldableOrd mono => MinLen (Succ nat) mono -> Element monoSource

like Data.List, but not partial on a MonoFoldable

minimum :: MonoFoldableOrd mono => MinLen (Succ nat) mono -> Element monoSource

like Data.List, but not partial on a MonoFoldable

maximumBy :: MonoFoldable mono => (Element mono -> Element mono -> Ordering) -> MinLen (Succ nat) mono -> Element monoSource

like Data.List, but not partial on a MonoFoldable

minimumBy :: MonoFoldable mono => (Element mono -> Element mono -> Ordering) -> MinLen (Succ nat) mono -> Element monoSource

like Data.List, but not partial on a MonoFoldable