mutable-lens-0.1.0.0: Interoperate mutable references with regular lens

Safe HaskellNone
LanguageHaskell2010

Control.Lens.Mutable.Internal

Documentation

class AsLens p s ref where Source #

Methods

asLens :: ref a -> SLens p s a Source #

Instances
AsLens OpST RealWorld IORef Source # 
Instance details

Defined in Control.Lens.Mutable.Internal

AsLens OpMVar RealWorld MVar Source #

View a MVar a as a SLens 'OpST RealWorld a.

Note: when this is eventually run in IO, the action will block the thread until there is a value present, as per the semantics of takeMVar#. It will then put a value into the MVar, which will block the thread if the value is absent. GHC doesn't give atomicity guarantees for MVar so it's possible this does happen, e.g. if another producer managed to "get in there" during the intervening period between the two operations. Unfortunately GHC does not provide an atomic modifyMVar function or primop.

If you don't want to deal with this, don't use an MVar, use a TMVar.

Instance details

Defined in Control.Lens.Mutable.Internal

AsLens OpSTM RealWorld TVar Source # 
Instance details

Defined in Control.Lens.Mutable.Internal

AsLens OpSTM RealWorld TMVar Source # 
Instance details

Defined in Control.Lens.Mutable.Internal

AsLens OpST s (STRef s) Source # 
Instance details

Defined in Control.Lens.Mutable.Internal

Methods

asLens :: STRef s a -> SLens OpST s a Source #

AsLens OpST s (MutVar s) Source # 
Instance details

Defined in Control.Lens.Mutable.Internal

Methods

asLens :: MutVar s a -> SLens OpST s a Source #