HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulefcf-containers-0.8.2Haskell2010

Fcf.Data.Set

Fcf.Data.Set

Set provides an interface which is similar to the that given by the containers-package. If a method is missing here that you need, please do open up an issue or better, make a PR.

Many of the examples are from containers-package. The internal representation is based on lists. We hope that a more efficient one will be used one day.

  • 17 types
newtypenewtype Set a
#

Set-definition.

Constructors

Instances10KnownVal, Eval, …

Query

6 declarations
datadata Member (a :: v) (b :: Set v) (c :: Bool)
#

Member

Example
:kind! Eval (Member 5 =<< FromList '[5, 3])

Eval (Member 5 =<< FromList '[5, 3]) :: Bool = 'True

:kind! Eval (Member 7 =<< FromList '[5, 3])

Eval (Member 7 =<< FromList '[5, 3]) :: Bool = 'False

Instances1Eval
datadata NotMember (a :: v) (b :: Set v) (c :: Bool)
#

NotMember

Example
:kind! Eval (NotMember 5 =<< FromList '[5, 3])

Eval (NotMember 5 =<< FromList '[5, 3]) :: Bool = 'False

:kind! Eval (NotMember 7 =<< FromList '[5, 3])

Eval (NotMember 7 =<< FromList '[5, 3]) :: Bool = 'True

Instances1Eval
datadata Null (a :: Set v) (b :: Bool)
#

Null

Example
:kind! Eval (Null =<< FromList '[5, 3])

Eval (Null =<< FromList '[5, 3]) :: Bool = 'False

:kind! Eval (Null =<< Empty)

Eval (Null =<< Empty) :: Bool = 'True

Instances2Eval
  • type Eval (Null ('Set '[])) = 'TrueDefined in fcf-containers-0.8.2 · Fcf.Data.Set
  • type Eval (Null ('Set (_1 ': _2))) = 'FalseDefined in fcf-containers-0.8.2 · Fcf.Data.Set
datadata Size (a :: Set v) (b :: Nat)
#

Size

Example
:kind! Eval (Size =<< FromList '[5, 3])

Eval (Size =<< FromList '[5, 3]) :: TL.Natural = 2

Instances1Eval
datadata IsSubsetOf (b :: Set a) (c :: Set a) (d :: Bool)
#

IsSubsetOf

Example
:kind! Eval (IsSubsetOf ('Set '[]) ('Set '[0,1,2,3,4]))

Eval (IsSubsetOf ('Set '[]) ('Set '[0,1,2,3,4])) :: Bool = 'True

:kind! Eval (IsSubsetOf ('Set '[0,1]) ('Set '[0,1,2,3,4]))

Eval (IsSubsetOf ('Set '[0,1]) ('Set '[0,1,2,3,4])) :: Bool = 'True

:kind! Eval (IsSubsetOf ('Set '[0,2,1,3,4]) ('Set '[0,1,2,3,4]))

Eval (IsSubsetOf ('Set '[0,2,1,3,4]) ('Set '[0,1,2,3,4])) :: Bool = 'True

:kind! Eval (IsSubsetOf ('Set '[0,1,2,3,4,5]) ('Set '[0,1,2,3,4]))

Eval (IsSubsetOf ('Set '[0,1,2,3,4,5]) ('Set '[0,1,2,3,4])) :: Bool = 'False

Instances1Eval
datadata IsProperSubsetOf (b :: Set a) (c :: Set a) (d :: Bool)
#

IsProperSubsetOf

Example
:kind! Eval (IsProperSubsetOf ('Set '[0,1,2,3,4]) ('Set '[0,1,2,3,4]))

Eval (IsProperSubsetOf ('Set '[0,1,2,3,4]) ('Set '[0,1,2,3,4])) :: Bool = 'False

:kind! Eval (IsProperSubsetOf ('Set '[0,2,1,3]) ('Set '[0,1,2,3,4]))

Eval (IsProperSubsetOf ('Set '[0,2,1,3]) ('Set '[0,1,2,3,4])) :: Bool = 'True

Instances1Eval

Construction

5 declarations
datadata Empty (a :: Set v)
#

Empty

Example
:kind! (Eval Empty :: Set Nat)

(Eval Empty :: Set Nat) :: Set TL.Natural = 'Set '[]

See also the other examples in this module.

Instances1Eval
  • type Eval Empty = 'Set '[]Defined in fcf-containers-0.8.2 · Fcf.Data.Set
datadata Singleton (a :: v) (b :: Set v)
#

Singleton

Example
:kind! Eval (Singleton 1)

Eval (Singleton 1) :: Set TL.Natural = 'Set '[1]

Instances1Eval
  • type Eval (Singleton v) = 'Set '[v]Defined in fcf-containers-0.8.2 · Fcf.Data.Set
datadata Insert (a :: v) (b :: Set v) (c :: Set v)
#

Insert

Example
:kind! Eval (Insert 3 =<< FromList '[1, 2])

Eval (Insert 3 =<< FromList '[1, 2]) :: Set TL.Natural = 'Set '[3, 1, 2]

:kind! Eval (Insert 2 =<< FromList '[1, 2])

Eval (Insert 2 =<< FromList '[1, 2]) :: Set TL.Natural = 'Set '[1, 2]

Instances1Eval
datadata Delete (a :: v) (b :: Set v) (c :: Set v)
#

Delete

Example
:kind! Eval (Delete 5 =<< FromList '[5, 3])

Eval (Delete 5 =<< FromList '[5, 3]) :: Set TL.Natural = 'Set '[3]

:kind! Eval (Delete 7 =<< FromList '[5, 3])

Eval (Delete 7 =<< FromList '[5, 3]) :: Set TL.Natural = 'Set '[5, 3]

Instances1Eval
datadata PowerSet (b :: Set a) (c :: Set (Set a))
#

Calculate the power sets of a given type-level list. The algorithm is based on Gray codes.

Example
:kind! Eval (PowerSet =<< FromList '["a", "b", "c"])

Eval (PowerSet =<< FromList '["a", "b", "c"]) :: Set (Set TL.Symbol) = 'Set '[ 'Set '[], 'Set '["c"], 'Set '["b"], 'Set '["b", "c"], 'Set '["a"], 'Set '["a", "b"], 'Set '["a", "c"], 'Set '["a", "b", "c"]]

:kind! Eval (PowerSet =<< FromList '[Int, Char, Maybe Int])

Eval (PowerSet =<< FromList '[Int, Char, Maybe Int]) :: Set (Set (*)) = 'Set '[ 'Set '[], 'Set '[Maybe Int], 'Set '[Char], 'Set '[Char, Maybe Int], 'Set '[Int], 'Set '[Int, Char], 'Set '[Int, Maybe Int], 'Set '[Int, Char, Maybe Int]]

Instances1Eval

Combine

3 declarations
datadata Union (a :: Set v) (b :: Set v) (c :: Set v)
#

Type-level set union.

Example
:kind! Eval (Union (Eval (FromList '[5, 3])) (Eval (FromList '[5, 7])) )

Eval (Union (Eval (FromList '[5, 3])) (Eval (FromList '[5, 7])) ) :: Set TL.Natural = 'Set '[7, 5, 3]

Instances1Eval
datadata Difference (a :: Set v) (b :: Set v) (c :: Set v)
#

Type-level set difference.

Example
:kind! Eval (Difference (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7])))

Eval (Difference (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7]))) :: Set TL.Natural = 'Set '[3]

Instances1Eval
datadata Intersection (a :: Set v) (b :: Set v) (c :: Set v)
#

Type-level set intersection.

Example
:kind! Eval (Intersection (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7])))

Eval (Intersection (Eval (FromList '[3, 5])) (Eval (FromList '[5, 7]))) :: Set TL.Natural = 'Set '[5]

Instances1Eval

List

2 declarations
datadata FromList (a :: [v]) (b :: Set v)
#

Use FromList to construct a Set from type-level list.

Example
:kind! Eval (FromList '[1, 2])

Eval (FromList '[1, 2]) :: Set TL.Natural = 'Set '[1, 2]

Instances1Eval
  • type Eval (FromList lst) = 'Set lstDefined in fcf-containers-0.8.2 · Fcf.Data.Set
datadata ToList (a :: Set v) (b :: [v])
#

Get the type-level list out of the Set.

Example
:kind! Eval (ToList =<< PowerSet =<< FromList '[1,2,3])

Eval (ToList =<< PowerSet =<< FromList '[1,2,3]) :: [Set TL.Natural] = '[ 'Set '[], 'Set '[3], 'Set '[2], 'Set '[2, 3], 'Set '[1], 'Set '[1, 2], 'Set '[1, 3], 'Set '[1, 2, 3]]

:kind! Eval (Qsort NatListOrd =<< Map ToList =<< ToList =<< PowerSet =<< FromList '[1,2,3])

Eval (Qsort NatListOrd =<< Map ToList =<< ToList =<< PowerSet =<< FromList '[1,2,3]) :: [[TL.Natural]] = '[ '[], '[1], '[1, 2], '[1, 2, 3], '[1, 3], '[2], '[2, 3], '[3]]

Instances1Eval
  • type Eval (ToList ('Set lst)) = lstDefined in fcf-containers-0.8.2 · Fcf.Data.Set