hgeometry-combinatorial-0.10.0.0: Data structures, and Data types.

Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageHaskell2010

Data.LSeq

Description

Description : Wrapper around Data.Sequence with type level length annotation.

Synopsis

Documentation

data LSeq (n :: Nat) a Source #

LSeq n a certifies that the sequence has *at least* n items

Instances
Functor (LSeq n) Source # 
Instance details

Defined in Data.LSeq

Methods

fmap :: (a -> b) -> LSeq n a -> LSeq n b #

(<$) :: a -> LSeq n b -> LSeq n a #

Foldable (LSeq n) Source # 
Instance details

Defined in Data.LSeq

Methods

fold :: Monoid m => LSeq n m -> m #

foldMap :: Monoid m => (a -> m) -> LSeq n a -> m #

foldr :: (a -> b -> b) -> b -> LSeq n a -> b #

foldr' :: (a -> b -> b) -> b -> LSeq n a -> b #

foldl :: (b -> a -> b) -> b -> LSeq n a -> b #

foldl' :: (b -> a -> b) -> b -> LSeq n a -> b #

foldr1 :: (a -> a -> a) -> LSeq n a -> a #

foldl1 :: (a -> a -> a) -> LSeq n a -> a #

toList :: LSeq n a -> [a] #

null :: LSeq n a -> Bool #

length :: LSeq n a -> Int #

elem :: Eq a => a -> LSeq n a -> Bool #

maximum :: Ord a => LSeq n a -> a #

minimum :: Ord a => LSeq n a -> a #

sum :: Num a => LSeq n a -> a #

product :: Num a => LSeq n a -> a #

Traversable (LSeq n) Source # 
Instance details

Defined in Data.LSeq

Methods

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

sequenceA :: Applicative f => LSeq n (f a) -> f (LSeq n a) #

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

sequence :: Monad m => LSeq n (m a) -> m (LSeq n a) #

1 <= n => Foldable1 (LSeq n) Source # 
Instance details

Defined in Data.LSeq

Methods

fold1 :: Semigroup m => LSeq n m -> m #

foldMap1 :: Semigroup m => (a -> m) -> LSeq n a -> m #

toNonEmpty :: LSeq n a -> NonEmpty a #

Eq a => Eq (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

(==) :: LSeq n a -> LSeq n a -> Bool #

(/=) :: LSeq n a -> LSeq n a -> Bool #

Ord a => Ord (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

compare :: LSeq n a -> LSeq n a -> Ordering #

(<) :: LSeq n a -> LSeq n a -> Bool #

(<=) :: LSeq n a -> LSeq n a -> Bool #

(>) :: LSeq n a -> LSeq n a -> Bool #

(>=) :: LSeq n a -> LSeq n a -> Bool #

max :: LSeq n a -> LSeq n a -> LSeq n a #

min :: LSeq n a -> LSeq n a -> LSeq n a #

Read a => Read (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

readsPrec :: Int -> ReadS (LSeq n a) #

readList :: ReadS [LSeq n a] #

readPrec :: ReadPrec (LSeq n a) #

readListPrec :: ReadPrec [LSeq n a] #

Show a => Show (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

showsPrec :: Int -> LSeq n a -> ShowS #

show :: LSeq n a -> String #

showList :: [LSeq n a] -> ShowS #

Generic (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Associated Types

type Rep (LSeq n a) :: Type -> Type #

Methods

from :: LSeq n a -> Rep (LSeq n a) x #

to :: Rep (LSeq n a) x -> LSeq n a #

Semigroup (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

(<>) :: LSeq n a -> LSeq n a -> LSeq n a #

sconcat :: NonEmpty (LSeq n a) -> LSeq n a #

stimes :: Integral b => b -> LSeq n a -> LSeq n a #

Monoid (LSeq 0 a) Source # 
Instance details

Defined in Data.LSeq

Methods

mempty :: LSeq 0 a #

mappend :: LSeq 0 a -> LSeq 0 a -> LSeq 0 a #

mconcat :: [LSeq 0 a] -> LSeq 0 a #

(KnownNat n, Arbitrary a) => Arbitrary (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

arbitrary :: Gen (LSeq n a) #

shrink :: LSeq n a -> [LSeq n a] #

ToJSON a => ToJSON (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

toJSON :: LSeq n a -> Value #

toEncoding :: LSeq n a -> Encoding #

toJSONList :: [LSeq n a] -> Value #

toEncodingList :: [LSeq n a] -> Encoding #

FromJSON a => FromJSON (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

parseJSON :: Value -> Parser (LSeq n a) #

parseJSONList :: Value -> Parser [LSeq n a] #

NFData a => NFData (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

rnf :: LSeq n a -> () #

Ixed (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

Methods

ix :: Index (LSeq n a) -> Traversal' (LSeq n a) (IxValue (LSeq n a)) #

type Rep (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

type Rep (LSeq n a) = D1 (MetaData "LSeq" "Data.LSeq" "hgeometry-combinatorial-0.10.0.0-KBhA9TX8xzkAsPm57THGXk" True) (C1 (MetaCons "LSeq" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Seq a))))
type Index (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

type Index (LSeq n a) = Int
type IxValue (LSeq n a) Source # 
Instance details

Defined in Data.LSeq

type IxValue (LSeq n a) = a

toSeq :: LSeq n a -> Seq a Source #

fromList :: Foldable f => f a -> LSeq 0 a Source #

fromSeq :: Seq a -> LSeq 0 a Source #

(<|) :: a -> LSeq n a -> LSeq (1 + n) a infixr 5 Source #

(|>) :: LSeq n a -> a -> LSeq (1 + n) a infixl 5 Source #

(><) :: LSeq n a -> LSeq m a -> LSeq (n + m) a infix 5 Source #

eval :: forall proxy n m a. KnownNat n => proxy n -> LSeq m a -> Maybe (LSeq n a) Source #

index :: LSeq n a -> Int -> a Source #

get the element with index i, counting from the left and starting at 0. O(log(min(i,n-i)))

adjust :: (a -> a) -> Int -> LSeq n a -> LSeq n a Source #

partition :: (a -> Bool) -> LSeq n a -> (LSeq 0 a, LSeq 0 a) Source #

mapWithIndex :: (Int -> a -> b) -> LSeq n a -> LSeq n b Source #

take :: Int -> LSeq n a -> LSeq 0 a Source #

drop :: Int -> LSeq n a -> LSeq 0 a Source #

unstableSort :: Ord a => LSeq n a -> LSeq n a Source #

unstableSortBy :: (a -> a -> Ordering) -> LSeq n a -> LSeq n a Source #

head :: LSeq (1 + n) a -> a Source #

Gets the first element of the LSeq

>>> head $ forceLSeq (Proxy :: Proxy 3) $ fromList [1,2,3]
1

last :: LSeq (1 + n) a -> a Source #

Get the last element of the LSeq

>>> last $ forceLSeq (Proxy :: Proxy 3) $ fromList [1,2,3]
3

append :: LSeq n a -> LSeq m a -> LSeq (n + m) a Source #

appends two sequences.

data ViewL n a where Source #

Constructors

(:<) :: a -> LSeq n a -> ViewL (1 + n) a infixr 5 
Instances
Functor (ViewL n) Source # 
Instance details

Defined in Data.LSeq

Methods

fmap :: (a -> b) -> ViewL n a -> ViewL n b #

(<$) :: a -> ViewL n b -> ViewL n a #

Foldable (ViewL n) Source # 
Instance details

Defined in Data.LSeq

Methods

fold :: Monoid m => ViewL n m -> m #

foldMap :: Monoid m => (a -> m) -> ViewL n a -> m #

foldr :: (a -> b -> b) -> b -> ViewL n a -> b #

foldr' :: (a -> b -> b) -> b -> ViewL n a -> b #

foldl :: (b -> a -> b) -> b -> ViewL n a -> b #

foldl' :: (b -> a -> b) -> b -> ViewL n a -> b #

foldr1 :: (a -> a -> a) -> ViewL n a -> a #

foldl1 :: (a -> a -> a) -> ViewL n a -> a #

toList :: ViewL n a -> [a] #

null :: ViewL n a -> Bool #

length :: ViewL n a -> Int #

elem :: Eq a => a -> ViewL n a -> Bool #

maximum :: Ord a => ViewL n a -> a #

minimum :: Ord a => ViewL n a -> a #

sum :: Num a => ViewL n a -> a #

product :: Num a => ViewL n a -> a #

Traversable (ViewL n) Source # 
Instance details

Defined in Data.LSeq

Methods

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

sequenceA :: Applicative f => ViewL n (f a) -> f (ViewL n a) #

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

sequence :: Monad m => ViewL n (m a) -> m (ViewL n a) #

Eq a => Eq (ViewL n a) Source # 
Instance details

Defined in Data.LSeq

Methods

(==) :: ViewL n a -> ViewL n a -> Bool #

(/=) :: ViewL n a -> ViewL n a -> Bool #

Ord a => Ord (ViewL n a) Source # 
Instance details

Defined in Data.LSeq

Methods

compare :: ViewL n a -> ViewL n a -> Ordering #

(<) :: ViewL n a -> ViewL n a -> Bool #

(<=) :: ViewL n a -> ViewL n a -> Bool #

(>) :: ViewL n a -> ViewL n a -> Bool #

(>=) :: ViewL n a -> ViewL n a -> Bool #

max :: ViewL n a -> ViewL n a -> ViewL n a #

min :: ViewL n a -> ViewL n a -> ViewL n a #

Show a => Show (ViewL n a) Source # 
Instance details

Defined in Data.LSeq

Methods

showsPrec :: Int -> ViewL n a -> ShowS #

show :: ViewL n a -> String #

showList :: [ViewL n a] -> ShowS #

Semigroup (ViewL n a) Source # 
Instance details

Defined in Data.LSeq

Methods

(<>) :: ViewL n a -> ViewL n a -> ViewL n a #

sconcat :: NonEmpty (ViewL n a) -> ViewL n a #

stimes :: Integral b => b -> ViewL n a -> ViewL n a #

viewl :: LSeq (1 + n) a -> ViewL (1 + n) a Source #

pattern (:<|) :: a -> LSeq n a -> LSeq (1 + n) a infixr 5 Source #

pattern (:<<) :: a -> LSeq 0 a -> LSeq n a infixr 5 Source #

pattern EmptyL :: LSeq n a Source #

data ViewR n a where Source #

Constructors

(:>) :: LSeq n a -> a -> ViewR (1 + n) a infixl 5 
Instances
Functor (ViewR n) Source # 
Instance details

Defined in Data.LSeq

Methods

fmap :: (a -> b) -> ViewR n a -> ViewR n b #

(<$) :: a -> ViewR n b -> ViewR n a #

Foldable (ViewR n) Source # 
Instance details

Defined in Data.LSeq

Methods

fold :: Monoid m => ViewR n m -> m #

foldMap :: Monoid m => (a -> m) -> ViewR n a -> m #

foldr :: (a -> b -> b) -> b -> ViewR n a -> b #

foldr' :: (a -> b -> b) -> b -> ViewR n a -> b #

foldl :: (b -> a -> b) -> b -> ViewR n a -> b #

foldl' :: (b -> a -> b) -> b -> ViewR n a -> b #

foldr1 :: (a -> a -> a) -> ViewR n a -> a #

foldl1 :: (a -> a -> a) -> ViewR n a -> a #

toList :: ViewR n a -> [a] #

null :: ViewR n a -> Bool #

length :: ViewR n a -> Int #

elem :: Eq a => a -> ViewR n a -> Bool #

maximum :: Ord a => ViewR n a -> a #

minimum :: Ord a => ViewR n a -> a #

sum :: Num a => ViewR n a -> a #

product :: Num a => ViewR n a -> a #

Traversable (ViewR n) Source # 
Instance details

Defined in Data.LSeq

Methods

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

sequenceA :: Applicative f => ViewR n (f a) -> f (ViewR n a) #

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

sequence :: Monad m => ViewR n (m a) -> m (ViewR n a) #

Eq a => Eq (ViewR n a) Source # 
Instance details

Defined in Data.LSeq

Methods

(==) :: ViewR n a -> ViewR n a -> Bool #

(/=) :: ViewR n a -> ViewR n a -> Bool #

Ord a => Ord (ViewR n a) Source # 
Instance details

Defined in Data.LSeq

Methods

compare :: ViewR n a -> ViewR n a -> Ordering #

(<) :: ViewR n a -> ViewR n a -> Bool #

(<=) :: ViewR n a -> ViewR n a -> Bool #

(>) :: ViewR n a -> ViewR n a -> Bool #

(>=) :: ViewR n a -> ViewR n a -> Bool #

max :: ViewR n a -> ViewR n a -> ViewR n a #

min :: ViewR n a -> ViewR n a -> ViewR n a #

Show a => Show (ViewR n a) Source # 
Instance details

Defined in Data.LSeq

Methods

showsPrec :: Int -> ViewR n a -> ShowS #

show :: ViewR n a -> String #

showList :: [ViewR n a] -> ShowS #

Semigroup (ViewR n a) Source # 
Instance details

Defined in Data.LSeq

Methods

(<>) :: ViewR n a -> ViewR n a -> ViewR n a #

sconcat :: NonEmpty (ViewR n a) -> ViewR n a #

stimes :: Integral b => b -> ViewR n a -> ViewR n a #

viewr :: LSeq (1 + n) a -> ViewR (1 + n) a Source #

pattern (:|>) :: forall n a. LSeq n a -> a -> LSeq (1 + n) a infixl 5 Source #

promise :: LSeq m a -> LSeq n a Source #

Promises that the length of this LSeq is actually n. This is not checked.

This function should be a noop

forceLSeq :: KnownNat n => proxy n -> LSeq m a -> LSeq n a Source #

Forces the first n elements of the LSeq