th-desugar-1.10: Functions to desugar Template Haskell

Copyright(C) 2016-2018 Daniel Wagner 2019 Ryan Scott
LicenseBSD-style (see LICENSE)
MaintainerRyan Scott
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Language.Haskell.TH.Desugar.OSet

Contents

Description

An OSet behaves much like a Set, with all the same asymptotics, but also remembers the order that values were inserted.

This module offers a simplified version of the Data.Set.Ordered API that assumes left-biased indices everywhere.

Synopsis

Documentation

data OSet a Source #

An ordered set whose insertPre, insertPost, intersection, and union operations are biased towards leftmost indices when when breaking ties between keys.

Instances
Foldable OSet Source # 
Instance details

Defined in Language.Haskell.TH.Desugar.OSet

Methods

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

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

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

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

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

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

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

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

toList :: OSet a -> [a] #

null :: OSet a -> Bool #

length :: OSet a -> Int #

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

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

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

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

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

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

Defined in Language.Haskell.TH.Desugar.OSet

Methods

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

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

(Data a, Ord a) => Data (OSet a) Source # 
Instance details

Defined in Language.Haskell.TH.Desugar.OSet

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OSet a -> c (OSet a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (OSet a) #

toConstr :: OSet a -> Constr #

dataTypeOf :: OSet a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (OSet a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OSet a)) #

gmapT :: (forall b. Data b => b -> b) -> OSet a -> OSet a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OSet a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OSet a -> r #

gmapQ :: (forall d. Data d => d -> u) -> OSet a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OSet a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OSet a -> m (OSet a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OSet a -> m (OSet a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OSet a -> m (OSet a) #

Ord a => Ord (OSet a) Source # 
Instance details

Defined in Language.Haskell.TH.Desugar.OSet

Methods

compare :: OSet a -> OSet a -> Ordering #

(<) :: OSet a -> OSet a -> Bool #

(<=) :: OSet a -> OSet a -> Bool #

(>) :: OSet a -> OSet a -> Bool #

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

max :: OSet a -> OSet a -> OSet a #

min :: OSet a -> OSet a -> OSet a #

(Ord a, Read a) => Read (OSet a) Source # 
Instance details

Defined in Language.Haskell.TH.Desugar.OSet

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

Defined in Language.Haskell.TH.Desugar.OSet

Methods

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

show :: OSet a -> String #

showList :: [OSet a] -> ShowS #

Ord a => Semigroup (OSet a) Source # 
Instance details

Defined in Language.Haskell.TH.Desugar.OSet

Methods

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

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

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

Ord a => Monoid (OSet a) Source # 
Instance details

Defined in Language.Haskell.TH.Desugar.OSet

Methods

mempty :: OSet a #

mappend :: OSet a -> OSet a -> OSet a #

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

Trivial sets

empty :: forall a. OSet a Source #

Insertion

insertPre :: Ord a => a -> OSet a -> OSet a Source #

The element's index will be lower than the indices of the elements in the OSet.

insertPost :: Ord a => OSet a -> a -> OSet a Source #

The element's index will be higher than the indices of the elements in the OSet.

union :: forall a. Ord a => OSet a -> OSet a -> OSet a Source #

Query

null :: forall a. OSet a -> Bool Source #

size :: forall a. OSet a -> Int Source #

member :: Ord a => a -> OSet a -> Bool Source #

notMember :: Ord a => a -> OSet a -> Bool Source #

Deletion

delete :: Ord a => a -> OSet a -> OSet a Source #

filter :: Ord a => (a -> Bool) -> OSet a -> OSet a Source #

(\\) :: forall a. Ord a => OSet a -> OSet a -> OSet a Source #

intersection :: forall a. Ord a => OSet a -> OSet a -> OSet a Source #

Indexing

type Index = Int #

A 0-based index, much like the indices used by lists' !! operation. All indices are with respect to insertion order.

lookupIndex :: Ord a => a -> OSet a -> Maybe Index Source #

lookupAt :: forall a. Index -> OSet a -> Maybe a Source #

List conversions

fromList :: Ord a => [a] -> OSet a Source #

toAscList :: forall a. OSet a -> [a] Source #

Set conversion

toSet :: forall a. OSet a -> Set a Source #