prosidy-1.6.0.1: A simple language for writing documents.
Copyright©2020 James Alexander Feldman-Crough
LicenseMPL-2.0
Maintaineralex@fldcr.com
Safe HaskellNone
LanguageHaskell2010

Prosidy.Types.Series

Description

 
Synopsis

Possibly empty collections

newtype Series a Source #

A newtype wrapper around a sequential collection.

Currently, Series is implemented as a Seq, but this is not guarenteed to be true.

Constructors

Series (Seq a) 

Instances

Instances details
Functor Series Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

fmap :: (a -> b) -> Series a -> Series b #

(<$) :: a -> Series b -> Series a #

Applicative Series Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

pure :: a -> Series a #

(<*>) :: Series (a -> b) -> Series a -> Series b #

liftA2 :: (a -> b -> c) -> Series a -> Series b -> Series c #

(*>) :: Series a -> Series b -> Series b #

(<*) :: Series a -> Series b -> Series a #

Foldable Series Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

fold :: Monoid m => Series m -> m #

foldMap :: Monoid m => (a -> m) -> Series a -> m #

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

foldr :: (a -> b -> b) -> b -> Series a -> b #

foldr' :: (a -> b -> b) -> b -> Series a -> b #

foldl :: (b -> a -> b) -> b -> Series a -> b #

foldl' :: (b -> a -> b) -> b -> Series a -> b #

foldr1 :: (a -> a -> a) -> Series a -> a #

foldl1 :: (a -> a -> a) -> Series a -> a #

toList :: Series a -> [a] #

null :: Series a -> Bool #

length :: Series a -> Int #

elem :: Eq a => a -> Series a -> Bool #

maximum :: Ord a => Series a -> a #

minimum :: Ord a => Series a -> a #

sum :: Num a => Series a -> a #

product :: Num a => Series a -> a #

Traversable Series Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

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

sequenceA :: Applicative f => Series (f a) -> f (Series a) #

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

sequence :: Monad m => Series (m a) -> m (Series a) #

Eq a => Eq (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

(==) :: Series a -> Series a -> Bool #

(/=) :: Series a -> Series a -> Bool #

Show a => Show (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

showsPrec :: Int -> Series a -> ShowS #

show :: Series a -> String #

showList :: [Series a] -> ShowS #

Generic (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

Associated Types

type Rep (Series a) :: Type -> Type #

Methods

from :: Series a -> Rep (Series a) x #

to :: Rep (Series a) x -> Series a #

Semigroup (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

(<>) :: Series a -> Series a -> Series a #

sconcat :: NonEmpty (Series a) -> Series a #

stimes :: Integral b => b -> Series a -> Series a #

Monoid (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

mempty :: Series a #

mappend :: Series a -> Series a -> Series a #

mconcat :: [Series a] -> Series a #

Hashable a => Hashable (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

hashWithSalt :: Int -> Series a -> Int #

hash :: Series a -> Int #

ToJSON a => ToJSON (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

FromJSON a => FromJSON (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

Binary a => Binary (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

put :: Series a -> Put #

get :: Get (Series a) #

putList :: [Series a] -> Put #

NFData a => NFData (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

rnf :: Series a -> () #

type Rep (Series a) Source # 
Instance details

Defined in Prosidy.Types.Series

type Rep (Series a) = D1 ('MetaData "Series" "Prosidy.Types.Series" "prosidy-1.6.0.1-inplace" 'True) (C1 ('MetaCons "Series" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Seq a))))

asSeq :: Functor f => (Seq a -> f (Seq b)) -> Series a -> f (Series b) Source #

Given a function which operates on a Seq, return a function which operates on a Series.

fromSeq :: Seq a -> Series a Source #

Convert a Seq into a Series.

toSeq :: Series a -> Seq a Source #

Convert a Series into a Seq.

Known non-empty collections

data SeriesNE a Source #

A non-empty Series.

Instances

Instances details
Functor SeriesNE Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

fmap :: (a -> b) -> SeriesNE a -> SeriesNE b #

(<$) :: a -> SeriesNE b -> SeriesNE a #

Applicative SeriesNE Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

pure :: a -> SeriesNE a #

(<*>) :: SeriesNE (a -> b) -> SeriesNE a -> SeriesNE b #

liftA2 :: (a -> b -> c) -> SeriesNE a -> SeriesNE b -> SeriesNE c #

(*>) :: SeriesNE a -> SeriesNE b -> SeriesNE b #

(<*) :: SeriesNE a -> SeriesNE b -> SeriesNE a #

Foldable SeriesNE Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

fold :: Monoid m => SeriesNE m -> m #

foldMap :: Monoid m => (a -> m) -> SeriesNE a -> m #

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

foldr :: (a -> b -> b) -> b -> SeriesNE a -> b #

foldr' :: (a -> b -> b) -> b -> SeriesNE a -> b #

foldl :: (b -> a -> b) -> b -> SeriesNE a -> b #

foldl' :: (b -> a -> b) -> b -> SeriesNE a -> b #

foldr1 :: (a -> a -> a) -> SeriesNE a -> a #

foldl1 :: (a -> a -> a) -> SeriesNE a -> a #

toList :: SeriesNE a -> [a] #

null :: SeriesNE a -> Bool #

length :: SeriesNE a -> Int #

elem :: Eq a => a -> SeriesNE a -> Bool #

maximum :: Ord a => SeriesNE a -> a #

minimum :: Ord a => SeriesNE a -> a #

sum :: Num a => SeriesNE a -> a #

product :: Num a => SeriesNE a -> a #

Traversable SeriesNE Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

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

sequenceA :: Applicative f => SeriesNE (f a) -> f (SeriesNE a) #

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

sequence :: Monad m => SeriesNE (m a) -> m (SeriesNE a) #

Eq a => Eq (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

(==) :: SeriesNE a -> SeriesNE a -> Bool #

(/=) :: SeriesNE a -> SeriesNE a -> Bool #

Show a => Show (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

showsPrec :: Int -> SeriesNE a -> ShowS #

show :: SeriesNE a -> String #

showList :: [SeriesNE a] -> ShowS #

Generic (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

Associated Types

type Rep (SeriesNE a) :: Type -> Type #

Methods

from :: SeriesNE a -> Rep (SeriesNE a) x #

to :: Rep (SeriesNE a) x -> SeriesNE a #

Semigroup (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

(<>) :: SeriesNE a -> SeriesNE a -> SeriesNE a #

sconcat :: NonEmpty (SeriesNE a) -> SeriesNE a #

stimes :: Integral b => b -> SeriesNE a -> SeriesNE a #

Hashable a => Hashable (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

hashWithSalt :: Int -> SeriesNE a -> Int #

hash :: SeriesNE a -> Int #

ToJSON a => ToJSON (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

FromJSON a => FromJSON (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

Binary a => Binary (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

put :: SeriesNE a -> Put #

get :: Get (SeriesNE a) #

putList :: [SeriesNE a] -> Put #

NFData a => NFData (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

Methods

rnf :: SeriesNE a -> () #

type Rep (SeriesNE a) Source # 
Instance details

Defined in Prosidy.Types.Series

type Rep (SeriesNE a) = D1 ('MetaData "SeriesNE" "Prosidy.Types.Series" "prosidy-1.6.0.1-inplace" 'True) (C1 ('MetaCons "SeriesNE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Seq a))))

fromSeqNE :: Seq a -> Maybe (SeriesNE a) Source #

Convert a non-empty Seq into a SeriesNE.

toSeqNE :: SeriesNE a -> Seq a Source #

Convert a SeriesNE into a Seq. The returned Seq is guarenteed to always contain at least one element.

Pattern synonyms for easy manipulation of series

pattern NonEmpty :: SeriesNE a -> Series a Source #

Matches a non-empty SeriesNE as if it were just a Series.

pattern Empty :: Series a Source #

Matches against an empty Series.

pattern (:>>:) :: Series a -> a -> SeriesNE a infixl 3 Source #

Match against a non-empty SeriesNE and a trailing element.

pattern (:<<:) :: a -> Series a -> SeriesNE a infixr 3 Source #

Match against a non-empty SeriesNE and a leading element.

pattern (:>:) :: Series a -> a -> Series a infixl 5 Source #

Match against the last element of a Series.

pattern (:<:) :: a -> Series a -> Series a infixr 5 Source #

Match against the first element of a Series.