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

HGeometry.Indexed

Description

Things that have an index.

Synopsis

Documentation

class HasIndex a where Source #

Types that have an index.

Methods

sosIndex :: a -> Index Source #

Get the index of a given a

Instances

Instances details
HasIndex (WithIndex a) Source # 
Instance details

Defined in HGeometry.Indexed

type Index = Int Source #

A type of Indices

data WithIndex a Source #

Associate a value of type a with an Index.

Constructors

WithIndex !Index a 

Instances

Instances details
Show a => Show (WithIndex a) Source # 
Instance details

Defined in HGeometry.Indexed

HasIndex (WithIndex a) Source # 
Instance details

Defined in HGeometry.Indexed

Field1 (WithIndex a) (WithIndex b) a b Source # 
Instance details

Defined in HGeometry.Indexed

Methods

_1 :: Lens (WithIndex a) (WithIndex b) a b Source #

theValue :: Lens (WithIndex a) (WithIndex b) a b Source #

Lens to manipulate the value of the WithIndex

labelWithIndex :: Traversable t => t a -> t (WithIndex a) Source #

Label each element with its index.

labelWith :: Traversable t => (Index -> a -> b) -> t a -> t b Source #

Label each element with its index using the given labelling function.

labelWith' :: forall t a b. Traversable t => (Index -> a -> b) -> t a -> (t b, Int) Source #

Label each element with its index using the given labelling function. Returns the new collection as well as its size.