hgeometry-combinatorial
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageGHC2021

HGeometry.Cyclic

Description

Representing Cyclic Sequences

Synopsis

Documentation

newtype Cyclic (v :: k -> Type) (a :: k) Source #

A cyclic sequence type

Constructors

Cyclic (v a) 

Instances

Instances details
FoldableWithIndex i v => FoldableWithIndex i (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

ifoldMap :: Monoid m => (i -> a -> m) -> Cyclic v a -> m Source #

ifoldMap' :: Monoid m => (i -> a -> m) -> Cyclic v a -> m Source #

ifoldr :: (i -> a -> b -> b) -> b -> Cyclic v a -> b Source #

ifoldl :: (i -> b -> a -> b) -> b -> Cyclic v a -> b Source #

ifoldr' :: (i -> a -> b -> b) -> b -> Cyclic v a -> b Source #

ifoldl' :: (i -> b -> a -> b) -> b -> Cyclic v a -> b Source #

FunctorWithIndex i v => FunctorWithIndex i (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

imap :: (i -> a -> b) -> Cyclic v a -> Cyclic v b Source #

TraversableWithIndex i v => TraversableWithIndex i (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

itraverse :: Applicative f => (i -> a -> f b) -> Cyclic v a -> f (Cyclic v b) Source #

Foldable1 v => Foldable1 (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

fold1 :: Semigroup m => Cyclic v m -> m #

foldMap1 :: Semigroup m => (a -> m) -> Cyclic v a -> m #

foldMap1' :: Semigroup m => (a -> m) -> Cyclic v a -> m #

toNonEmpty :: Cyclic v a -> NonEmpty a #

maximum :: Ord a => Cyclic v a -> a #

minimum :: Ord a => Cyclic v a -> a #

head :: Cyclic v a -> a #

last :: Cyclic v a -> a #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Cyclic v a -> b #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Cyclic v a -> b #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Cyclic v a -> b #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Cyclic v a -> b #

Functor v => Functor (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

fmap :: (a -> b) -> Cyclic v a -> Cyclic v b #

(<$) :: a -> Cyclic v b -> Cyclic v a #

Foldable v => Foldable (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

fold :: Monoid m => Cyclic v m -> m #

foldMap :: Monoid m => (a -> m) -> Cyclic v a -> m #

foldMap' :: Monoid m => (a -> m) -> Cyclic v a -> m #

foldr :: (a -> b -> b) -> b -> Cyclic v a -> b #

foldr' :: (a -> b -> b) -> b -> Cyclic v a -> b #

foldl :: (b -> a -> b) -> b -> Cyclic v a -> b #

foldl' :: (b -> a -> b) -> b -> Cyclic v a -> b #

foldr1 :: (a -> a -> a) -> Cyclic v a -> a #

foldl1 :: (a -> a -> a) -> Cyclic v a -> a #

toList :: Cyclic v a -> [a] #

null :: Cyclic v a -> Bool #

length :: Cyclic v a -> Int #

elem :: Eq a => a -> Cyclic v a -> Bool #

maximum :: Ord a => Cyclic v a -> a #

minimum :: Ord a => Cyclic v a -> a #

sum :: Num a => Cyclic v a -> a #

product :: Num a => Cyclic v a -> a #

Traversable v => Traversable (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

traverse :: Applicative f => (a -> f b) -> Cyclic v a -> f (Cyclic v b) #

sequenceA :: Applicative f => Cyclic v (f a) -> f (Cyclic v a) #

mapM :: Monad m => (a -> m b) -> Cyclic v a -> m (Cyclic v b) #

sequence :: Monad m => Cyclic v (m a) -> m (Cyclic v a) #

HasDirectedTraversals v => HasDirectedTraversals (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

HasFromFoldable v => HasFromFoldable (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

fromFoldable :: Foldable g => g a -> Cyclic v a Source #

fromList :: [a] -> Cyclic v a Source #

HasFromFoldable1 v => HasFromFoldable1 (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

fromFoldable1 :: Foldable1 g => g a -> Cyclic v a Source #

fromNonEmpty :: NonEmpty a -> Cyclic v a Source #

Traversable1 v => Traversable1 (Cyclic v) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

traverse1 :: Apply f => (a -> f b) -> Cyclic v a -> f (Cyclic v b) Source #

sequence1 :: Apply f => Cyclic v (f b) -> f (Cyclic v b) Source #

FromJSON (v a) => FromJSON (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

ToJSON (v a) => ToJSON (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

NFData (v a) => NFData (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

rnf :: Cyclic v a -> () #

Generic (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

Associated Types

type Rep (Cyclic v a) 
Instance details

Defined in HGeometry.Cyclic

type Rep (Cyclic v a) = D1 ('MetaData "Cyclic" "HGeometry.Cyclic" "hgeometry-combinatorial-1.0.0.0-inplace" 'True) (C1 ('MetaCons "Cyclic" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (v a))))

Methods

from :: Cyclic v a -> Rep (Cyclic v a) x #

to :: Rep (Cyclic v a) x -> Cyclic v a #

Eq (v a) => Eq (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

(==) :: Cyclic v a -> Cyclic v a -> Bool #

(/=) :: Cyclic v a -> Cyclic v a -> Bool #

Foldable1 v => ShiftedEq (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

Associated Types

type ElemCyclic (Cyclic v a) 
Instance details

Defined in HGeometry.Cyclic

type ElemCyclic (Cyclic v a) = a

Methods

isShiftOf :: Cyclic v a -> Cyclic v a -> Bool Source #

(Index (v a) ~ Int, Foldable v, Ixed (v a)) => Ixed (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

ix :: Index (Cyclic v a) -> Traversal' (Cyclic v a) (IxValue (Cyclic v a)) Source #

Reversing (v a) => Reversing (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

Methods

reversing :: Cyclic v a -> Cyclic v a Source #

type Rep (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

type Rep (Cyclic v a) = D1 ('MetaData "Cyclic" "HGeometry.Cyclic" "hgeometry-combinatorial-1.0.0.0-inplace" 'True) (C1 ('MetaCons "Cyclic" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (v a))))
type ElemCyclic (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

type ElemCyclic (Cyclic v a) = a
type Index (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

type Index (Cyclic v a) = Index (v a)
type IxValue (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

type IxValue (Cyclic v a) = IxValue (v a)

class HasDirectedTraversals (v :: Type -> Type) where Source #

Class that models that some type has a cyclic traversal starting from a particular index.

Methods

traverseRightFrom :: Index (v a) -> IndexedTraversal1' (Index (v a)) (v a) a Source #

A rightward-traversal over all elements starting from the given one.

running time : \(O(n)\)

traverseLeftFrom :: Index (v a) -> IndexedTraversal1' (Index (v a)) (v a) a Source #

A rightward-traversal over all elements starting from the given one.

running time : \(O(n)\)

class ShiftedEq t where Source #

Class for types that have an Equality test up to cyclic shifts

Associated Types

type ElemCyclic t Source #

The type of the elements stored in this cyclic container.

Methods

isShiftOf :: t -> t -> Bool Source #

Given a and b, test if a is a shifted version of the other.

Instances

Instances details
Foldable1 v => ShiftedEq (Cyclic v a) Source # 
Instance details

Defined in HGeometry.Cyclic

Associated Types

type ElemCyclic (Cyclic v a) 
Instance details

Defined in HGeometry.Cyclic

type ElemCyclic (Cyclic v a) = a

Methods

isShiftOf :: Cyclic v a -> Cyclic v a -> Bool Source #