Safe Haskell | None |
---|---|

Language | Haskell2010 |

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

This is a variation on `Data.Set.`

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

## Instances

Foldable Set Source # | |

Defined in Dhall.Set fold :: Monoid m => Set m -> m # foldMap :: Monoid m => (a -> m) -> Set a -> m # foldr :: (a -> b -> b) -> b -> Set a -> b # foldr' :: (a -> b -> b) -> b -> Set a -> b # foldl :: (b -> a -> b) -> b -> Set a -> b # foldl' :: (b -> a -> b) -> b -> Set a -> b # foldr1 :: (a -> a -> a) -> Set a -> a # foldl1 :: (a -> a -> a) -> Set a -> a # elem :: Eq a => a -> Set a -> Bool # maximum :: Ord a => Set a -> a # | |

Eq a => Eq (Set a) Source # | |

(Data a, Ord a) => Data (Set a) Source # | |

Defined in Dhall.Set gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Set a -> c (Set a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Set a) # dataTypeOf :: Set a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Set a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set a)) # gmapT :: (forall b. Data b => b -> b) -> Set a -> Set a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set a -> r # gmapQ :: (forall d. Data d => d -> u) -> Set a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Set a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Set a -> m (Set a) # | |

Ord a => Ord (Set a) Source # | |

Show a => Show (Set a) Source # | |

Generic (Set a) Source # | |

Lift a => Lift (Set a) Source # | |

NFData a => NFData (Set a) Source # | |

type Rep (Set a) Source # | |

Defined in Dhall.Set type Rep (Set a) = D1 (MetaData "Set" "Dhall.Set" "dhall-1.32.0-90ekLWlfiRUK7vmmlOVhVv" 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

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.

`>>>`

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