Copyright | Copyright (c) Patrick Perry <patperry@stanford.edu> |
---|---|
License | BSD3 |
Maintainer | Patrick Perry <patperry@stanford.edu> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell98 |
Data.Permute.ST
Description
Mutable permutations in the ST
monad.
Synopsis
- data STPermute s
- runSTPermute :: (forall s. ST s (STPermute s)) -> Permute
- module Data.Permute.MPermute
Permutations
A mutable permutation that can be manipulated in the ST
monad. The
type argument s
is the state variable argument for the ST
type.
Instances
Eq (STPermute s) Source # | |
MPermute (STPermute s) (ST s) Source # | |
Defined in Data.Permute.MPermute Methods getSize :: STPermute s -> ST s Int Source # newPermute :: Int -> ST s (STPermute s) Source # newPermute_ :: Int -> ST s (STPermute s) Source # unsafeGetElem :: STPermute s -> Int -> ST s Int Source # unsafeSetElem :: STPermute s -> Int -> Int -> ST s () Source # unsafeSwapElems :: STPermute s -> Int -> Int -> ST s () Source # getElems :: STPermute s -> ST s [Int] Source # setElems :: STPermute s -> [Int] -> ST s () Source # unsafeFreeze :: STPermute s -> ST s Permute Source # unsafeThaw :: Permute -> ST s (STPermute s) Source # unsafeInterleaveM :: ST s a -> ST s a |
runSTPermute :: (forall s. ST s (STPermute s)) -> Permute Source #
A safe way to create and work with a mutable permutation before returning an immutable one for later perusal. This function avoids copying the permutation before returning it - it uses unsafeFreeze internally, but this wrapper is a safe interface to that function.
Overloaded mutable permutation interface
module Data.Permute.MPermute