WeakSets: Simple set types. Useful to create sets of arbitrary types and nested sets.

[ data, lgpl, library ] [ Propose Tags ]

This package answers two problems : how to make sets of types which does not implement the Ord typeclass and how to make arbitrarily nested sets as set theory allows. The first problem is resolved thanks to HomogeneousSet which is a list where duplicates elements are not allowed and the order of elements is forgotten. The second problem is resolved thanks to PureSet, it is a tree structure where the order of the branches does not matter.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.3.0.0, 0.4.0.0, 1.0.0.0, 1.1.0.0, 1.1.1.0, 1.1.2.0, 1.1.3.0, 1.1.4.0, 1.2.0.0, 1.2.2.0, 1.2.3.0, 1.2.4.0, 1.3.0.0, 1.3.1.0, 1.3.2.0, 1.3.3.0, 1.4.0.0, 1.4.0.1, 1.5.0.0, 1.6.0.0, 1.6.1.0
Change log CHANGELOG.md
Dependencies base (>=4.15.0.0 && <4.16) [details]
License LGPL-3.0-or-later
Author Guillaume Sabbagh
Maintainer guillaumesabbagh@protonmail.com
Category Data, Math
Home page https://gitlab.utc.fr/gsabbagh/sets
Uploaded by gsabbagh at 2022-07-16T10:41:27Z
Distributions
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 809 total (50 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for WeakSets-0.4.0.0

[back to package description]

WeakSets

This is a Haskell package which defines sets in a more general way than Data.Set.

Data.Set only allows to create sets of types which implements the Ord typeclass, this package introduces HomogeneousSet which does not require the typeclass Ord.

The PureSet type allows to create nested sets easily. It may be used to study set theory for example.

General info

The homogenous sets implemented in this package require the type contained in the set to implement the typeclass Eq. It ensures there are no duplicate element in the set and that the order of elements does not matter when testing equality. It is slower than Data.Set because we do not require the Ord typeclass, if you only use types which are orderable, use Data.Set instead.

The pure set type implemented in this package is a tree like structure where the order of branches does not matter. It allows arbitrary nesting of sets which is useful to do set theoretic constructions.

Installation

cabal install WeakSets

Usage

Example usage of homogenous sets :

ghci> import HomogeneousSet
ghci> data Foo = Foo Int Char deriving (Eq) -- an arbitrary type which is not required to implement >Ord typeclass
ghci> s1 = set [Foo 3 'a', Foo 2 'c', Foo 3 'a']
ghci> s2 = set [Foo 2 'c', Foo 3 'a']
ghci> s1 == s2
True

Example usage of pure sets :

ghci> import PureSet
ghci> numberToSet 3
(pureSet [(pureSet []),(pureSet [(pureSet [])]),(pureSet [(pureSet []),(pureSet [(pureSet [])])])])
ghci> putStrLn.prettify $ numberToSet 3
{{}, {{}}, {{}, {{}}}}

Contribution

Any input is appreciated ! Send an email for any remark or question. The git repository : https://gitlab.utc.fr/gsabbagh/sets