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

HGeometry.Ext

Description

A pair-like data type to represent a core type that has extra information as well.

Synopsis

Documentation

data core :+ extra infixr 1 Source #

Our Ext type that represents the core datatype core extended with extra information of type extra.

Constructors

core :+ extra infixr 1 

Instances

Instances details
Bifoldable (:+) Source # 
Instance details

Defined in HGeometry.Ext

Methods

bifold :: Monoid m => (m :+ m) -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> (a :+ b) -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> (a :+ b) -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> (a :+ b) -> c #

Bifoldable1 (:+) Source # 
Instance details

Defined in HGeometry.Ext

Methods

bifold1 :: Semigroup m => (m :+ m) -> m #

bifoldMap1 :: Semigroup m => (a -> m) -> (b -> m) -> (a :+ b) -> m #

Bifunctor (:+) Source # 
Instance details

Defined in HGeometry.Ext

Methods

bimap :: (a -> b) -> (c -> d) -> (a :+ c) -> b :+ d #

first :: (a -> b) -> (a :+ c) -> b :+ c #

second :: (b -> c) -> (a :+ b) -> a :+ c #

Bitraversable (:+) Source # 
Instance details

Defined in HGeometry.Ext

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> (a :+ b) -> f (c :+ d) #

Biapplicative (:+) Source # 
Instance details

Defined in HGeometry.Ext

Methods

bipure :: a -> b -> a :+ b Source #

(<<*>>) :: ((a -> b) :+ (c -> d)) -> (a :+ c) -> b :+ d Source #

biliftA2 :: (a -> b -> c) -> (d -> e -> f) -> (a :+ d) -> (b :+ e) -> c :+ f Source #

(*>>) :: (a :+ b) -> (c :+ d) -> c :+ d Source #

(<<*) :: (a :+ b) -> (c :+ d) -> a :+ b Source #

Biapply (:+) Source # 
Instance details

Defined in HGeometry.Ext

Methods

(<<.>>) :: ((a -> b) :+ (c -> d)) -> (a :+ c) -> b :+ d Source #

(.>>) :: (a :+ b) -> (c :+ d) -> c :+ d Source #

(<<.) :: (a :+ b) -> (c :+ d) -> a :+ b Source #

Bitraversable1 (:+) Source # 
Instance details

Defined in HGeometry.Ext

Methods

bitraverse1 :: Apply f => (a -> f b) -> (c -> f d) -> (a :+ c) -> f (b :+ d) Source #

bisequence1 :: Apply f => (f a :+ f b) -> f (a :+ b) Source #

Functor ((:+) c) Source # 
Instance details

Defined in HGeometry.Ext

Methods

fmap :: (a -> b) -> (c :+ a) -> c :+ b #

(<$) :: a -> (c :+ b) -> c :+ a #

Foldable ((:+) c) Source # 
Instance details

Defined in HGeometry.Ext

Methods

fold :: Monoid m => (c :+ m) -> m #

foldMap :: Monoid m => (a -> m) -> (c :+ a) -> m #

foldMap' :: Monoid m => (a -> m) -> (c :+ a) -> m #

foldr :: (a -> b -> b) -> b -> (c :+ a) -> b #

foldr' :: (a -> b -> b) -> b -> (c :+ a) -> b #

foldl :: (b -> a -> b) -> b -> (c :+ a) -> b #

foldl' :: (b -> a -> b) -> b -> (c :+ a) -> b #

foldr1 :: (a -> a -> a) -> (c :+ a) -> a #

foldl1 :: (a -> a -> a) -> (c :+ a) -> a #

toList :: (c :+ a) -> [a] #

null :: (c :+ a) -> Bool #

length :: (c :+ a) -> Int #

elem :: Eq a => a -> (c :+ a) -> Bool #

maximum :: Ord a => (c :+ a) -> a #

minimum :: Ord a => (c :+ a) -> a #

sum :: Num a => (c :+ a) -> a #

product :: Num a => (c :+ a) -> a #

Traversable ((:+) c) Source # 
Instance details

Defined in HGeometry.Ext

Methods

traverse :: Applicative f => (a -> f b) -> (c :+ a) -> f (c :+ b) #

sequenceA :: Applicative f => (c :+ f a) -> f (c :+ a) #

mapM :: Monad m => (a -> m b) -> (c :+ a) -> m (c :+ b) #

sequence :: Monad m => (c :+ m a) -> m (c :+ a) #

(FromJSON core, FromJSON extra) => FromJSON (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

parseJSON :: Value -> Parser (core :+ extra) Source #

parseJSONList :: Value -> Parser [core :+ extra] Source #

omittedField :: Maybe (core :+ extra) Source #

(ToJSON core, ToJSON extra) => ToJSON (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

toJSON :: (core :+ extra) -> Value Source #

toEncoding :: (core :+ extra) -> Encoding Source #

toJSONList :: [core :+ extra] -> Value Source #

toEncodingList :: [core :+ extra] -> Encoding Source #

omitField :: (core :+ extra) -> Bool Source #

(Default core, Default extra) => Default (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

def :: core :+ extra Source #

(NFData core, NFData extra) => NFData (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

rnf :: (core :+ extra) -> () #

(Semigroup core, Semigroup extra) => Semigroup (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

(<>) :: (core :+ extra) -> (core :+ extra) -> core :+ extra #

sconcat :: NonEmpty (core :+ extra) -> core :+ extra #

stimes :: Integral b => b -> (core :+ extra) -> core :+ extra #

(Bounded core, Bounded extra) => Bounded (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

minBound :: core :+ extra #

maxBound :: core :+ extra #

Generic (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Associated Types

type Rep (core :+ extra) 
Instance details

Defined in HGeometry.Ext

type Rep (core :+ extra) = D1 ('MetaData ":+" "HGeometry.Ext" "hgeometry-combinatorial-1.0.0.0-inplace" 'False) (C1 ('MetaCons ":+" ('InfixI 'RightAssociative 1) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 core) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 extra)))

Methods

from :: (core :+ extra) -> Rep (core :+ extra) x #

to :: Rep (core :+ extra) x -> core :+ extra #

(Read core, Read extra) => Read (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

readsPrec :: Int -> ReadS (core :+ extra) #

readList :: ReadS [core :+ extra] #

readPrec :: ReadPrec (core :+ extra) #

readListPrec :: ReadPrec [core :+ extra] #

(Show core, Show extra) => Show (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

showsPrec :: Int -> (core :+ extra) -> ShowS #

show :: (core :+ extra) -> String #

showList :: [core :+ extra] -> ShowS #

(Eq core, Eq extra) => Eq (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

(==) :: (core :+ extra) -> (core :+ extra) -> Bool #

(/=) :: (core :+ extra) -> (core :+ extra) -> Bool #

(Ord core, Ord extra) => Ord (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

compare :: (core :+ extra) -> (core :+ extra) -> Ordering #

(<) :: (core :+ extra) -> (core :+ extra) -> Bool #

(<=) :: (core :+ extra) -> (core :+ extra) -> Bool #

(>) :: (core :+ extra) -> (core :+ extra) -> Bool #

(>=) :: (core :+ extra) -> (core :+ extra) -> Bool #

max :: (core :+ extra) -> (core :+ extra) -> core :+ extra #

min :: (core :+ extra) -> (core :+ extra) -> core :+ extra #

AsExt (c :+ e) Source # 
Instance details

Defined in HGeometry.Ext

Associated Types

type CoreOf (c :+ e) 
Instance details

Defined in HGeometry.Ext

type CoreOf (c :+ e) = c
type ExtraOf (c :+ e) 
Instance details

Defined in HGeometry.Ext

type ExtraOf (c :+ e) = e

Methods

_Ext :: Iso' (c :+ e) (CoreOf (c :+ e) :+ ExtraOf (c :+ e)) Source #

(Uniform core, Uniform extra) => Uniform (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

uniformM :: StatefulGen g m => g -> m (core :+ extra) Source #

(UniformRange core, UniformRange extra) => UniformRange (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

Methods

uniformRM :: StatefulGen g m => (core :+ extra, core :+ extra) -> g -> m (core :+ extra) Source #

AsA (c :+ e) c Source #

An Ext can act as its core.

Instance details

Defined in HGeometry.Ext

Methods

asCore :: (c :+ e) -> c Source #

type Rep (core :+ extra) Source # 
Instance details

Defined in HGeometry.Ext

type Rep (core :+ extra) = D1 ('MetaData ":+" "HGeometry.Ext" "hgeometry-combinatorial-1.0.0.0-inplace" 'False) (C1 ('MetaCons ":+" ('InfixI 'RightAssociative 1) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 core) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 extra)))
type CoreOf (c :+ e) Source # 
Instance details

Defined in HGeometry.Ext

type CoreOf (c :+ e) = c
type ExtraOf (c :+ e) Source # 
Instance details

Defined in HGeometry.Ext

type ExtraOf (c :+ e) = e

_core :: (core :+ extra) -> core Source #

Access the core of an extended value.

_extra :: (core :+ extra) -> extra Source #

Access the extra part of an extended value.

core :: forall core extra core' f. Functor f => (core -> f core') -> (core :+ extra) -> f (core' :+ extra) Source #

Lens access to the core of an extended value.

extra :: forall core extra extra' f. Functor f => (extra -> f extra') -> (core :+ extra) -> f (core :+ extra') Source #

Lens access to the extra part of an extended value.

ext :: a -> a :+ () Source #

Tag a value with the unit type.

class AsA t c | t -> c where Source #

A class for types that can behave as a c. Mostly for types t that "extend" a core type c.

Methods

asCore :: t -> c Source #

Get the core from the t.

Instances

Instances details
t ~ c => AsA t c Source #

Everything can act as itself

Instance details

Defined in HGeometry.Ext

Methods

asCore :: t -> c Source #

AsA (c :+ e) c Source #

An Ext can act as its core.

Instance details

Defined in HGeometry.Ext

Methods

asCore :: (c :+ e) -> c Source #

type (:~) t c = AsA t c Source #

infifx shorthand for AsA

pattern AsA :: t :~ c => c -> t Source #

Pattern to get the core.

class AsExt t where Source #

Types that can be decomposed into an Ext

Associated Types

type CoreOf t Source #

type ExtraOf t Source #

Methods

_Ext :: Iso' t (CoreOf t :+ ExtraOf t) Source #

Convert between this type and an Ext

Instances

Instances details
AsExt (c :+ e) Source # 
Instance details

Defined in HGeometry.Ext

Associated Types

type CoreOf (c :+ e) 
Instance details

Defined in HGeometry.Ext

type CoreOf (c :+ e) = c
type ExtraOf (c :+ e) 
Instance details

Defined in HGeometry.Ext

type ExtraOf (c :+ e) = e

Methods

_Ext :: Iso' (c :+ e) (CoreOf (c :+ e) :+ ExtraOf (c :+ e)) Source #

asIndexedExt :: (Indexable i p, Functor f) => p (s :+ i) (f (t :+ j)) -> Indexed i s (f t) Source #

Helper to run an indexed something into an Ext in which the index is the extra info

>>> "foobar" ^.. ifolded . asIndexedExt
['f' :+ 0,'o' :+ 1,'o' :+ 2,'b' :+ 3,'a' :+ 4,'r' :+ 5]