permutation-0.5.0.5: A library for permutations and combinations.

CopyrightCopyright (c) Patrick Perry <patperry@stanford.edu>
LicenseBSD3
MaintainerPatrick Perry <patperry@stanford.edu>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Data.Choose.ST

Contents

Description

Mutable combinations in the ST monad.

Synopsis

Combinations

data STChoose s #

A mutable combination that can be manipulated in the ST monad. The type argument s is the state variable argument for the ST type.

Instances

Eq (STChoose s) # 

Methods

(==) :: STChoose s -> STChoose s -> Bool #

(/=) :: STChoose s -> STChoose s -> Bool #

MChoose (STChoose s) (ST s) # 

Methods

getPossible :: STChoose s -> ST s Int #

getSize :: STChoose s -> ST s Int #

newChoose :: Int -> Int -> ST s (STChoose s) #

newChoose_ :: Int -> Int -> ST s (STChoose s) #

unsafeGetElem :: STChoose s -> Int -> ST s Int #

unsafeSetElem :: STChoose s -> Int -> Int -> ST s () #

getElems :: STChoose s -> ST s [Int] #

setElems :: STChoose s -> [Int] -> ST s () #

unsafeFreeze :: STChoose s -> ST s Choose #

unsafeThaw :: Choose -> ST s (STChoose s) #

runSTChoose :: (forall s. ST s (STChoose s)) -> Choose #

A safe way to create and work with a mutable combination before returning an immutable one for later perusal. This function avoids copying the combination before returning it - it uses unsafeFreeze internally, but this wrapper is a safe interface to that function.

Overloaded mutable combination interface