miso
Copyright(C) 2016-2025 David M. Johnson (@dmjio)
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Data.Set

Description

Mutable Set data structure in IO.

A JavaScript Set. This is a convenience for manipulating JavaScript data structures from Haskell.

We recommend using this module qualified.

import qualified Miso.Data.Set as M
Synopsis

Type

data Set key Source #

Instances

Instances details
FromJSVal (Set key) Source # 
Instance details

Defined in Miso.Data.Set

Methods

fromJSVal :: JSVal -> IO (Maybe (Set key)) Source #

fromJSValUnchecked :: JSVal -> IO (Set key) Source #

ToJSVal (Set key) Source # 
Instance details

Defined in Miso.Data.Set

Methods

toJSVal :: Set key -> IO JSVal Source #

Construction

new :: IO (Set key) Source #

Constructs a new JS Set in IO.

fromList :: ToJSVal key => [key] -> IO (Set key) Source #

Construct a Set from a list of key value pairs.

Operations

insert :: ToJSVal key => key -> Set key -> IO () Source #

Inserts a value into the Set by key.

member :: ToJSVal key => key -> Set key -> IO Bool Source #

Checks existence of key in Set, returns t'Bool.

clear :: Set key -> IO () Source #

Empties the Set.

size :: Set key -> IO Int Source #

Return the size of Set.

delete :: ToJSVal key => key -> Set key -> IO Bool Source #

Removes an entry from a list, returns if the value was removed as Bool.

union :: ToJSVal key => Set key -> Set key -> IO (Set key) Source #

The union of two Set

intersection :: ToJSVal key => Set key -> Set key -> IO (Set key) Source #

The intersection of two Set

difference :: ToJSVal key => Set key -> Set key -> IO (Set key) Source #

The symmetric difference of two Set

isSubset :: ToJSVal key => Set key -> Set key -> IO Bool Source #

Checks if one Set is a subset of another Set

isSuperset :: ToJSVal key => Set key -> Set key -> IO Bool Source #

Checks if one Set is a superset of another Set

isDisjoint :: ToJSVal key => Set key -> Set key -> IO Bool Source #

Checks if one Set is disjoint from another Set