Movatterモバイル変換


[0]ホーム

URL:


base-4.12.0.0: Basic libraries

Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilitynon-portable (requires universal quantification for runST)
Safe HaskellTrustworthy
LanguageHaskell2010

Control.Monad.ST.Safe

Contents

Description

Deprecated: Safe is now the default, please use Control.Monad.ST instead

This library provides support forstrict state threads, as described in the PLDI '94 paper by John Launchbury and Simon Peyton JonesLazy Functional State Threads.

Safe API Only.

Synopsis

TheST Monad

dataST s aSource#

The strict state-transformer monad. A computation of typeST s a transforms an internal state indexed bys, and returns a value of typea. Thes parameter is either

  • an uninstantiated type variable (inside invocations ofrunST), or
  • RealWorld (inside invocations ofstToIO).

It serves to keep the internal states of different invocations ofrunST separate from each other and from invocations ofstToIO.

The>>= and>> operations are strict in the state (though not in values stored in the state). For example,

runST (writeSTRef _|_ v >>= f) = _|_
Instances
Monad (ST s)Source#

Since: 2.1

Instance details

Defined inGHC.ST

Methods

(>>=) ::ST s a -> (a ->ST s b) ->ST s bSource#

(>>) ::ST s a ->ST s b ->ST s bSource#

return :: a ->ST s aSource#

fail ::String ->ST s aSource#

Functor (ST s)Source#

Since: 2.1

Instance details

Defined inGHC.ST

Methods

fmap :: (a -> b) ->ST s a ->ST s bSource#

(<$) :: a ->ST s b ->ST s aSource#

MonadFix (ST s)Source#

Since: 2.1

Instance details

Defined inControl.Monad.Fix

Methods

mfix :: (a ->ST s a) ->ST s aSource#

MonadFail (ST s)Source#

Since: 4.11.0.0

Instance details

Defined inGHC.ST

Methods

fail ::String ->ST s aSource#

Applicative (ST s)Source#

Since: 4.4.0.0

Instance details

Defined inGHC.ST

Methods

pure :: a ->ST s aSource#

(<*>) ::ST s (a -> b) ->ST s a ->ST s bSource#

liftA2 :: (a -> b -> c) ->ST s a ->ST s b ->ST s cSource#

(*>) ::ST s a ->ST s b ->ST s bSource#

(<*) ::ST s a ->ST s b ->ST s aSource#

Show (ST s a)Source#

Since: 2.1

Instance details

Defined inGHC.ST

Semigroup a =>Semigroup (ST s a)Source#

Since: 4.11.0.0

Instance details

Defined inGHC.ST

Methods

(<>) ::ST s a ->ST s a ->ST s aSource#

sconcat ::NonEmpty (ST s a) ->ST s aSource#

stimes ::Integral b => b ->ST s a ->ST s aSource#

Monoid a =>Monoid (ST s a)Source#

Since: 4.11.0.0

Instance details

Defined inGHC.ST

Methods

mempty ::ST s aSource#

mappend ::ST s a ->ST s a ->ST s aSource#

mconcat :: [ST s a] ->ST s aSource#

runST :: (forall s.ST s a) -> aSource#

Return the value computed by a state transformer computation. Theforall ensures that the internal state used by theST computation is inaccessible to the rest of the program.

fixST :: (a ->ST s a) ->ST s aSource#

Allow the result of a state transformer computation to be used (lazily) inside the computation.

Note that iff is strict,fixST f = _|_.

ConvertingST toIO

dataRealWorld ::Type#

RealWorld is deeply magical. It isprimitive, but it is notunlifted (henceptrArg). We never manipulate values of typeRealWorld; it's only used in the type system, to parameteriseState#.

stToIO ::STRealWorld a ->IO aSource#

Embed a strict state transformer in anIO action. TheRealWorld parameter indicates that the internal state used by theST computation is a special one supplied by theIO monad, and thus distinct from those used by invocations ofrunST.

Produced byHaddock version 2.20.0


[8]ページ先頭

©2009-2025 Movatter.jp