ArrayRef-0.1.3.1: Unboxed references, dynamic arrays and moreSource codeContentsIndex
Data.Ref.Universal
PortabilityHugs/GHC
Stabilityexperimental
MaintainerBulat Ziganshin <Bulat.Ziganshin@gmail.com>
Contents
Monad-independent interface for boxed references
Monad-independent interface for unboxed references
Description
Monad-independent interfaces for boxed and unboxed references
Synopsis
class Monad m => Ref m r | m -> r, r -> m where
newRef :: a -> m (r a)
readRef :: r a -> m a
writeRef :: r a -> a -> m ()
modifyRef :: Ref m r => r a -> (a -> a) -> m ()
modifyRefM :: Ref m r => r a -> (a -> m a) -> m ()
class Monad m => URef m r | m -> r, r -> m where
newURef :: Unboxed a => a -> m (r a)
readURef :: Unboxed a => r a -> m a
writeURef :: Unboxed a => r a -> a -> m ()
modifyURef :: (Unboxed a, URef m r) => r a -> (a -> a) -> m ()
modifyURefM :: (Unboxed a, URef m r) => r a -> (a -> m a) -> m ()
Monad-independent interface for boxed references
class Monad m => Ref m r | m -> r, r -> m whereSource
This class allows to create new boxed reference in monad-independent way (suitable for writing code that will work in IO, ST and other monads)
Methods
newRef :: a -> m (r a)Source
Create a new Ref with given initial value
readRef :: r a -> m aSource
Read the value of an Ref
writeRef :: r a -> a -> m ()Source
Write new value into an Ref
show/hide Instances
modifyRef :: Ref m r => r a -> (a -> a) -> m ()Source
Modify the contents of an Ref by applying pure function to it
modifyRefM :: Ref m r => r a -> (a -> m a) -> m ()Source
Modify the contents of an Ref by applying monadic computation to it
Monad-independent interface for unboxed references
class Monad m => URef m r | m -> r, r -> m whereSource
This class allows to create new unboxed reference in monad-independent way (suitable for writing code that will work in IO, ST and other monads)
Methods
newURef :: Unboxed a => a -> m (r a)Source
Create a new URef with given initial value
readURef :: Unboxed a => r a -> m aSource
Read the value of an URef
writeURef :: Unboxed a => r a -> a -> m ()Source
Write new value into an URef
show/hide Instances
modifyURef :: (Unboxed a, URef m r) => r a -> (a -> a) -> m ()Source
Modify the contents of an URef by applying pure function to it
modifyURefM :: (Unboxed a, URef m r) => r a -> (a -> m a) -> m ()Source
Modify the contents of an URef by applying monadic computation to it
Produced by Haddock version 2.4.2