dhall-1.41.2: A configuration language guaranteed to terminate

Safe Haskell | Safe-Inferred
Language | Haskell2010

Dhall.Set

Description

This module only exports ways of constructing a Set, retrieving List, Set, and Seq representations of the same data, as well as a novel "difference" function. Any other Set-like or List-like functionality should be obtained through toSet and toList, respectively.

Synopsis

- data Set a = Set (Set a) (Seq a)
- toList :: Set a -> [a]
- toAscList :: Set a -> [a]
- toSet :: Set a -> Set a
- toSeq :: Set a -> Seq a
- fromList :: Ord a => [a] -> Set a
- fromSet :: Set a -> Set a
- append :: Ord a => a -> Set a -> Set a
- empty :: Set a
- difference :: Ord a => Set a -> Set a -> [a]
- sort :: Ord a => Set a -> Set a
- isSorted :: Ord a => Set a -> Bool
- null :: Set a -> Bool
- size :: Set a -> Int

# Documentation

data Set a Source #

This is a variation on `Data.Set.`Set`` that remembers the original order of elements. This ensures that ordering is not lost when formatting Dhall code

Constructors

Set (Set a) (Seq a) |

#### Instances

Instances details

Foldable Set Source # |

Instance details

Defined in Dhall.Set

Methods

fold :: Monoid m => Set m -> m Source #

foldMap :: Monoid m => (a -> m) -> Set a -> m Source #

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

foldr :: (a -> b -> b) -> b -> Set a -> b Source #

foldr' :: (a -> b -> b) -> b -> Set a -> b Source #

foldl :: (b -> a -> b) -> b -> Set a -> b Source #

foldl' :: (b -> a -> b) -> b -> Set a -> b Source #

foldr1 :: (a -> a -> a) -> Set a -> a Source #

foldl1 :: (a -> a -> a) -> Set a -> a Source #

toList :: Set a -> [a] Source #

null :: Set a -> Bool Source #

length :: Set a -> Int Source #

elem :: Eq a => a -> Set a -> Bool Source #

maximum :: Ord a => Set a -> a Source #

minimum :: Ord a => Set a -> a Source #

sum :: Num a => Set a -> a Source #

product :: Num a => Set a -> a Source #

Lift a => Lift (Set a :: Type) Source # |
Instance details Defined in Dhall.Set Methods lift :: Quote m => Set a -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Set a -> Code m (Set a) Source #
(Data a, Ord a) => Data (Set a) Source # |

Instance details

Defined in Dhall.Set

Methods

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

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

toConstr :: Set a -> Constr Source #

dataTypeOf :: Set a -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic (Set a) Source # |
Instance details Defined in Dhall.Set Associated Types type Rep (Set a) :: Type -> Type Source # Methods from :: Set a -> Rep (Set a) x Source # to :: Rep (Set a) x -> Set a Source #
Show a => Show (Set a) Source # |
Instance details Defined in Dhall.Set Methods showsPrec :: Int -> Set a -> ShowS Source # show :: Set a -> String Source # showList :: [Set a] -> ShowS Source #
NFData a => NFData (Set a) Source # |
Instance details Defined in Dhall.Set Methods rnf :: Set a -> () Source #
Eq a => Eq (Set a) Source # |
Instance details Defined in Dhall.Set Methods (==) :: Set a -> Set a -> Bool Source # (/=) :: Set a -> Set a -> Bool Source #
Ord a => Ord (Set a) Source # |
Instance details Defined in Dhall.Set Methods compare :: Set a -> Set a -> Ordering Source # (<) :: Set a -> Set a -> Bool Source # (<=) :: Set a -> Set a -> Bool Source # (>) :: Set a -> Set a -> Bool Source # (>=) :: Set a -> Set a -> Bool Source # max :: Set a -> Set a -> Set a Source # min :: Set a -> Set a -> Set a Source #
type Rep (Set a) Source # |

Instance details

Defined in Dhall.Set

type Rep (Set a) = D1 ('MetaData "Set" "Dhall.Set" "dhall-1.41.2-AmbmZIyY3Qg7BXVQFY7oVI" 'False) (C1 ('MetaCons "Set" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Seq a))))

toList :: Set a -> [a] Source #

Convert a `Set` to a list, preserving the original order of the elements

toAscList :: Set a -> [a] Source #

Convert a `Set` to a list of ascending elements

toSet :: Set a -> Set a Source #

Convert to an unordered `Data.Set.`Set``

toSeq :: Set a -> Seq a Source #

Convert to an ordered `Seq`

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

Convert a list to a `Set`, remembering the element order

fromSet :: Set a -> Set a Source #

Convert a `Data.Set.`Set`` to a sorted `Set`

append :: Ord a => a -> Set a -> Set a Source #

Append an element to the end of a `Set`

empty :: Set a Source #

The empty `Set`

difference :: Ord a => Set a -> Set a -> [a] Source #

Returns, in order, all elements of the first Set not present in the second. (It doesn't matter in what order the elements appear in the second Set.)

sort :: Ord a => Set a -> Set a Source #

Sort the set elements, forgetting their original ordering.

    >>> sort (fromList [2, 1]) == fromList [1, 2]
    True

isSorted :: Ord a => Set a -> Bool Source #

    >>> isSorted (fromList [2, 1])
    False
    >>> isSorted (fromList [1, 2])
    True

null :: Set a -> Bool Source #

    >>> null (fromList [1])
    False
    >>> null (fromList [])
    True

size :: Set a -> Int Source #

    >>> size (fromList [1])
    1