opto-0.1.0.0: General-purpose performant numeric optimization library

Copyright(c) Justin Le 2019
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Numeric.Opto.Ref

Contents

Description

Abstract over different types for mutable references of values.

Synopsis

Documentation

class Monad m => Mutable m a where Source #

Minimal complete definition

Nothing

Associated Types

type Ref m a = (v :: Type) | v -> a Source #

Methods

thawRef :: a -> m (Ref m a) Source #

freezeRef :: Ref m a -> m a Source #

copyRef :: Ref m a -> a -> m () Source #

modifyRef :: Ref m a -> (a -> a) -> m () Source #

Apply a pure function on an immutable value onto a value stored in a mutable reference.

modifyRef' :: Ref m a -> (a -> a) -> m () Source #

modifyRef, but forces the result before storing it back in the reference.

updateRef :: Ref m a -> (a -> (a, b)) -> m b Source #

Apply a pure function on an immutable value onto a value stored in a mutable reference, returning a result value from that function.

updateRef' :: Ref m a -> (a -> (a, b)) -> m b Source #

updateRef, but forces the updated value before storing it back in the reference.

thawRef :: (Ref m a ~ MutVar (PrimState m) a, PrimMonad m) => a -> m (Ref m a) Source #

freezeRef :: (Ref m a ~ MutVar (PrimState m) a, PrimMonad m) => Ref m a -> m a Source #

copyRef :: (Ref m a ~ MutVar (PrimState m) a, PrimMonad m) => Ref m a -> a -> m () Source #

Instances
Monad m => Mutable m () Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m () = (v :: Type) Source #

Methods

thawRef :: () -> m (Ref m ()) Source #

freezeRef :: Ref m () -> m () Source #

copyRef :: Ref m () -> () -> m () Source #

modifyRef :: Ref m () -> (() -> ()) -> m () Source #

modifyRef' :: Ref m () -> (() -> ()) -> m () Source #

updateRef :: Ref m () -> (() -> ((), b)) -> m b Source #

updateRef' :: Ref m () -> (() -> ((), b)) -> m b Source #

PrimMonad m => Mutable m Double Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m Double = (v :: Type) Source #

Methods

thawRef :: Double -> m (Ref m Double) Source #

freezeRef :: Ref m Double -> m Double Source #

copyRef :: Ref m Double -> Double -> m () Source #

modifyRef :: Ref m Double -> (Double -> Double) -> m () Source #

modifyRef' :: Ref m Double -> (Double -> Double) -> m () Source #

updateRef :: Ref m Double -> (Double -> (Double, b)) -> m b Source #

updateRef' :: Ref m Double -> (Double -> (Double, b)) -> m b Source #

PrimMonad m => Mutable m Float Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m Float = (v :: Type) Source #

Methods

thawRef :: Float -> m (Ref m Float) Source #

freezeRef :: Ref m Float -> m Float Source #

copyRef :: Ref m Float -> Float -> m () Source #

modifyRef :: Ref m Float -> (Float -> Float) -> m () Source #

modifyRef' :: Ref m Float -> (Float -> Float) -> m () Source #

updateRef :: Ref m Float -> (Float -> (Float, b)) -> m b Source #

updateRef' :: Ref m Float -> (Float -> (Float, b)) -> m b Source #

PrimMonad m => Mutable m Integer Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m Integer = (v :: Type) Source #

Methods

thawRef :: Integer -> m (Ref m Integer) Source #

freezeRef :: Ref m Integer -> m Integer Source #

copyRef :: Ref m Integer -> Integer -> m () Source #

modifyRef :: Ref m Integer -> (Integer -> Integer) -> m () Source #

modifyRef' :: Ref m Integer -> (Integer -> Integer) -> m () Source #

updateRef :: Ref m Integer -> (Integer -> (Integer, b)) -> m b Source #

updateRef' :: Ref m Integer -> (Integer -> (Integer, b)) -> m b Source #

PrimMonad m => Mutable m Int Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m Int = (v :: Type) Source #

Methods

thawRef :: Int -> m (Ref m Int) Source #

freezeRef :: Ref m Int -> m Int Source #

copyRef :: Ref m Int -> Int -> m () Source #

modifyRef :: Ref m Int -> (Int -> Int) -> m () Source #

modifyRef' :: Ref m Int -> (Int -> Int) -> m () Source #

updateRef :: Ref m Int -> (Int -> (Int, b)) -> m b Source #

updateRef' :: Ref m Int -> (Int -> (Int, b)) -> m b Source #

(PrimMonad m, KnownNat n) => Mutable m (C n) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (C n) = (v :: Type) Source #

Methods

thawRef :: C n -> m (Ref m (C n)) Source #

freezeRef :: Ref m (C n) -> m (C n) Source #

copyRef :: Ref m (C n) -> C n -> m () Source #

modifyRef :: Ref m (C n) -> (C n -> C n) -> m () Source #

modifyRef' :: Ref m (C n) -> (C n -> C n) -> m () Source #

updateRef :: Ref m (C n) -> (C n -> (C n, b)) -> m b Source #

updateRef' :: Ref m (C n) -> (C n -> (C n, b)) -> m b Source #

(PrimMonad m, KnownNat n) => Mutable m (R n) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (R n) = (v :: Type) Source #

Methods

thawRef :: R n -> m (Ref m (R n)) Source #

freezeRef :: Ref m (R n) -> m (R n) Source #

copyRef :: Ref m (R n) -> R n -> m () Source #

modifyRef :: Ref m (R n) -> (R n -> R n) -> m () Source #

modifyRef' :: Ref m (R n) -> (R n -> R n) -> m () Source #

updateRef :: Ref m (R n) -> (R n -> (R n, b)) -> m b Source #

updateRef' :: Ref m (R n) -> (R n -> (R n, b)) -> m b Source #

(PrimMonad m, Element a) => Mutable m (Matrix a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Matrix a) = (v :: Type) Source #

Methods

thawRef :: Matrix a -> m (Ref m (Matrix a)) Source #

freezeRef :: Ref m (Matrix a) -> m (Matrix a) Source #

copyRef :: Ref m (Matrix a) -> Matrix a -> m () Source #

modifyRef :: Ref m (Matrix a) -> (Matrix a -> Matrix a) -> m () Source #

modifyRef' :: Ref m (Matrix a) -> (Matrix a -> Matrix a) -> m () Source #

updateRef :: Ref m (Matrix a) -> (Matrix a -> (Matrix a, b)) -> m b Source #

updateRef' :: Ref m (Matrix a) -> (Matrix a -> (Matrix a, b)) -> m b Source #

(PrimMonad m, Prim a) => Mutable m (Vector a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Vector a) = (v :: Type) Source #

Methods

thawRef :: Vector a -> m (Ref m (Vector a)) Source #

freezeRef :: Ref m (Vector a) -> m (Vector a) Source #

copyRef :: Ref m (Vector a) -> Vector a -> m () Source #

modifyRef :: Ref m (Vector a) -> (Vector a -> Vector a) -> m () Source #

modifyRef' :: Ref m (Vector a) -> (Vector a -> Vector a) -> m () Source #

updateRef :: Ref m (Vector a) -> (Vector a -> (Vector a, b)) -> m b Source #

updateRef' :: Ref m (Vector a) -> (Vector a -> (Vector a, b)) -> m b Source #

(PrimMonad m, Unbox a) => Mutable m (Vector a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Vector a) = (v :: Type) Source #

Methods

thawRef :: Vector a -> m (Ref m (Vector a)) Source #

freezeRef :: Ref m (Vector a) -> m (Vector a) Source #

copyRef :: Ref m (Vector a) -> Vector a -> m () Source #

modifyRef :: Ref m (Vector a) -> (Vector a -> Vector a) -> m () Source #

modifyRef' :: Ref m (Vector a) -> (Vector a -> Vector a) -> m () Source #

updateRef :: Ref m (Vector a) -> (Vector a -> (Vector a, b)) -> m b Source #

updateRef' :: Ref m (Vector a) -> (Vector a -> (Vector a, b)) -> m b Source #

(PrimMonad m, Storable a) => Mutable m (Vector a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Vector a) = (v :: Type) Source #

Methods

thawRef :: Vector a -> m (Ref m (Vector a)) Source #

freezeRef :: Ref m (Vector a) -> m (Vector a) Source #

copyRef :: Ref m (Vector a) -> Vector a -> m () Source #

modifyRef :: Ref m (Vector a) -> (Vector a -> Vector a) -> m () Source #

modifyRef' :: Ref m (Vector a) -> (Vector a -> Vector a) -> m () Source #

updateRef :: Ref m (Vector a) -> (Vector a -> (Vector a, b)) -> m b Source #

updateRef' :: Ref m (Vector a) -> (Vector a -> (Vector a, b)) -> m b Source #

PrimMonad m => Mutable m (Vector a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Vector a) = (v :: Type) Source #

Methods

thawRef :: Vector a -> m (Ref m (Vector a)) Source #

freezeRef :: Ref m (Vector a) -> m (Vector a) Source #

copyRef :: Ref m (Vector a) -> Vector a -> m () Source #

modifyRef :: Ref m (Vector a) -> (Vector a -> Vector a) -> m () Source #

modifyRef' :: Ref m (Vector a) -> (Vector a -> Vector a) -> m () Source #

updateRef :: Ref m (Vector a) -> (Vector a -> (Vector a, b)) -> m b Source #

updateRef' :: Ref m (Vector a) -> (Vector a -> (Vector a, b)) -> m b Source #

PrimMonad m => Mutable m (MutRef a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (MutRef a) = (v :: Type) Source #

Methods

thawRef :: MutRef a -> m (Ref m (MutRef a)) Source #

freezeRef :: Ref m (MutRef a) -> m (MutRef a) Source #

copyRef :: Ref m (MutRef a) -> MutRef a -> m () Source #

modifyRef :: Ref m (MutRef a) -> (MutRef a -> MutRef a) -> m () Source #

modifyRef' :: Ref m (MutRef a) -> (MutRef a -> MutRef a) -> m () Source #

updateRef :: Ref m (MutRef a) -> (MutRef a -> (MutRef a, b)) -> m b Source #

updateRef' :: Ref m (MutRef a) -> (MutRef a -> (MutRef a, b)) -> m b Source #

PrimMonad m => Mutable m (Complex a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Complex a) = (v :: Type) Source #

Methods

thawRef :: Complex a -> m (Ref m (Complex a)) Source #

freezeRef :: Ref m (Complex a) -> m (Complex a) Source #

copyRef :: Ref m (Complex a) -> Complex a -> m () Source #

modifyRef :: Ref m (Complex a) -> (Complex a -> Complex a) -> m () Source #

modifyRef' :: Ref m (Complex a) -> (Complex a -> Complex a) -> m () Source #

updateRef :: Ref m (Complex a) -> (Complex a -> (Complex a, b)) -> m b Source #

updateRef' :: Ref m (Complex a) -> (Complex a -> (Complex a, b)) -> m b Source #

PrimMonad m => Mutable m (Ratio a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Ratio a) = (v :: Type) Source #

Methods

thawRef :: Ratio a -> m (Ref m (Ratio a)) Source #

freezeRef :: Ref m (Ratio a) -> m (Ratio a) Source #

copyRef :: Ref m (Ratio a) -> Ratio a -> m () Source #

modifyRef :: Ref m (Ratio a) -> (Ratio a -> Ratio a) -> m () Source #

modifyRef' :: Ref m (Ratio a) -> (Ratio a -> Ratio a) -> m () Source #

updateRef :: Ref m (Ratio a) -> (Ratio a -> (Ratio a, b)) -> m b Source #

updateRef' :: Ref m (Ratio a) -> (Ratio a -> (Ratio a, b)) -> m b Source #

(PrimMonad m, KnownNat n, KnownNat k) => Mutable m (M n k) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (M n k) = (v :: Type) Source #

Methods

thawRef :: M n k -> m (Ref m (M n k)) Source #

freezeRef :: Ref m (M n k) -> m (M n k) Source #

copyRef :: Ref m (M n k) -> M n k -> m () Source #

modifyRef :: Ref m (M n k) -> (M n k -> M n k) -> m () Source #

modifyRef' :: Ref m (M n k) -> (M n k -> M n k) -> m () Source #

updateRef :: Ref m (M n k) -> (M n k -> (M n k, b)) -> m b Source #

updateRef' :: Ref m (M n k) -> (M n k -> (M n k, b)) -> m b Source #

(PrimMonad m, KnownNat n, KnownNat k) => Mutable m (L n k) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (L n k) = (v :: Type) Source #

Methods

thawRef :: L n k -> m (Ref m (L n k)) Source #

freezeRef :: Ref m (L n k) -> m (L n k) Source #

copyRef :: Ref m (L n k) -> L n k -> m () Source #

modifyRef :: Ref m (L n k) -> (L n k -> L n k) -> m () Source #

modifyRef' :: Ref m (L n k) -> (L n k -> L n k) -> m () Source #

updateRef :: Ref m (L n k) -> (L n k -> (L n k, b)) -> m b Source #

updateRef' :: Ref m (L n k) -> (L n k -> (L n k, b)) -> m b Source #

(Monad m, Mutable m a, Mutable m b) => Mutable m (a, b) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (a, b) = (v :: Type) Source #

Methods

thawRef :: (a, b) -> m (Ref m (a, b)) Source #

freezeRef :: Ref m (a, b) -> m (a, b) Source #

copyRef :: Ref m (a, b) -> (a, b) -> m () Source #

modifyRef :: Ref m (a, b) -> ((a, b) -> (a, b)) -> m () Source #

modifyRef' :: Ref m (a, b) -> ((a, b) -> (a, b)) -> m () Source #

updateRef :: Ref m (a, b) -> ((a, b) -> ((a, b), b0)) -> m b0 Source #

updateRef' :: Ref m (a, b) -> ((a, b) -> ((a, b), b0)) -> m b0 Source #

(Monad m, Mutable m (f a2), Mutable m (Rec f as), Ref m (Rec f as) ~ Rec (RecRef m f) as) => Mutable m (Rec f (a2 ': as)) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Rec f (a2 ': as)) = (v :: Type) Source #

Methods

thawRef :: Rec f (a2 ': as) -> m (Ref m (Rec f (a2 ': as))) Source #

freezeRef :: Ref m (Rec f (a2 ': as)) -> m (Rec f (a2 ': as)) Source #

copyRef :: Ref m (Rec f (a2 ': as)) -> Rec f (a2 ': as) -> m () Source #

modifyRef :: Ref m (Rec f (a2 ': as)) -> (Rec f (a2 ': as) -> Rec f (a2 ': as)) -> m () Source #

modifyRef' :: Ref m (Rec f (a2 ': as)) -> (Rec f (a2 ': as) -> Rec f (a2 ': as)) -> m () Source #

updateRef :: Ref m (Rec f (a2 ': as)) -> (Rec f (a2 ': as) -> (Rec f (a2 ': as), b)) -> m b Source #

updateRef' :: Ref m (Rec f (a2 ': as)) -> (Rec f (a2 ': as) -> (Rec f (a2 ': as), b)) -> m b Source #

Monad m => Mutable m (Rec f ([] :: [u])) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Rec f []) = (v :: Type) Source #

Methods

thawRef :: Rec f [] -> m (Ref m (Rec f [])) Source #

freezeRef :: Ref m (Rec f []) -> m (Rec f []) Source #

copyRef :: Ref m (Rec f []) -> Rec f [] -> m () Source #

modifyRef :: Ref m (Rec f []) -> (Rec f [] -> Rec f []) -> m () Source #

modifyRef' :: Ref m (Rec f []) -> (Rec f [] -> Rec f []) -> m () Source #

updateRef :: Ref m (Rec f []) -> (Rec f [] -> (Rec f [], b)) -> m b Source #

updateRef' :: Ref m (Rec f []) -> (Rec f [] -> (Rec f [], b)) -> m b Source #

(Monad m, Mutable m a, Mutable m b, Mutable m c) => Mutable m (a, b, c) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (a, b, c) = (v :: Type) Source #

Methods

thawRef :: (a, b, c) -> m (Ref m (a, b, c)) Source #

freezeRef :: Ref m (a, b, c) -> m (a, b, c) Source #

copyRef :: Ref m (a, b, c) -> (a, b, c) -> m () Source #

modifyRef :: Ref m (a, b, c) -> ((a, b, c) -> (a, b, c)) -> m () Source #

modifyRef' :: Ref m (a, b, c) -> ((a, b, c) -> (a, b, c)) -> m () Source #

updateRef :: Ref m (a, b, c) -> ((a, b, c) -> ((a, b, c), b0)) -> m b0 Source #

updateRef' :: Ref m (a, b, c) -> ((a, b, c) -> ((a, b, c), b0)) -> m b0 Source #

(PrimMonad m, Vector v a) => Mutable m (Vector v n a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (Vector v n a) = (v :: Type) Source #

Methods

thawRef :: Vector v n a -> m (Ref m (Vector v n a)) Source #

freezeRef :: Ref m (Vector v n a) -> m (Vector v n a) Source #

copyRef :: Ref m (Vector v n a) -> Vector v n a -> m () Source #

modifyRef :: Ref m (Vector v n a) -> (Vector v n a -> Vector v n a) -> m () Source #

modifyRef' :: Ref m (Vector v n a) -> (Vector v n a -> Vector v n a) -> m () Source #

updateRef :: Ref m (Vector v n a) -> (Vector v n a -> (Vector v n a, b)) -> m b Source #

updateRef' :: Ref m (Vector v n a) -> (Vector v n a -> (Vector v n a, b)) -> m b Source #

(Monad n, Mutable m a, Reifies s (ReMutableTrans m n)) => Mutable n (ReMutable s m a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref n (ReMutable s m a) = (v :: Type) Source #

Methods

thawRef :: ReMutable s m a -> n (Ref n (ReMutable s m a)) Source #

freezeRef :: Ref n (ReMutable s m a) -> n (ReMutable s m a) Source #

copyRef :: Ref n (ReMutable s m a) -> ReMutable s m a -> n () Source #

modifyRef :: Ref n (ReMutable s m a) -> (ReMutable s m a -> ReMutable s m a) -> n () Source #

modifyRef' :: Ref n (ReMutable s m a) -> (ReMutable s m a -> ReMutable s m a) -> n () Source #

updateRef :: Ref n (ReMutable s m a) -> (ReMutable s m a -> (ReMutable s m a, b)) -> n b Source #

updateRef' :: Ref n (ReMutable s m a) -> (ReMutable s m a -> (ReMutable s m a, b)) -> n b Source #

(Monad m, Mutable m a, Mutable m b, Mutable m c, Mutable m d) => Mutable m (a, b, c, d) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (a, b, c, d) = (v :: Type) Source #

Methods

thawRef :: (a, b, c, d) -> m (Ref m (a, b, c, d)) Source #

freezeRef :: Ref m (a, b, c, d) -> m (a, b, c, d) Source #

copyRef :: Ref m (a, b, c, d) -> (a, b, c, d) -> m () Source #

modifyRef :: Ref m (a, b, c, d) -> ((a, b, c, d) -> (a, b, c, d)) -> m () Source #

modifyRef' :: Ref m (a, b, c, d) -> ((a, b, c, d) -> (a, b, c, d)) -> m () Source #

updateRef :: Ref m (a, b, c, d) -> ((a, b, c, d) -> ((a, b, c, d), b0)) -> m b0 Source #

updateRef' :: Ref m (a, b, c, d) -> ((a, b, c, d) -> ((a, b, c, d), b0)) -> m b0 Source #

newtype MutRef a Source #

Newtype wrapper that can provide any type with a Mutable instance. Can be useful for avoiding orphan instances.

Constructors

MutRef 

Fields

Instances
PrimMonad m => Mutable m (MutRef a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref m (MutRef a) = (v :: Type) Source #

Methods

thawRef :: MutRef a -> m (Ref m (MutRef a)) Source #

freezeRef :: Ref m (MutRef a) -> m (MutRef a) Source #

copyRef :: Ref m (MutRef a) -> MutRef a -> m () Source #

modifyRef :: Ref m (MutRef a) -> (MutRef a -> MutRef a) -> m () Source #

modifyRef' :: Ref m (MutRef a) -> (MutRef a -> MutRef a) -> m () Source #

updateRef :: Ref m (MutRef a) -> (MutRef a -> (MutRef a, b)) -> m b Source #

updateRef' :: Ref m (MutRef a) -> (MutRef a -> (MutRef a, b)) -> m b Source #

IsoHKD MutRef (a :: Type) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type HKD MutRef a :: Type #

Methods

unHKD :: HKD MutRef a -> MutRef a #

toHKD :: MutRef a -> HKD MutRef a #

type Ref m (MutRef a) Source # 
Instance details

Defined in Numeric.Opto.Ref

type Ref m (MutRef a) = MutVar (PrimState m) (MutRef a)
type HKD MutRef (a :: Type) Source # 
Instance details

Defined in Numeric.Opto.Ref

type HKD MutRef (a :: Type) = MutRef a

newtype RefFor m a Source #

Constructors

RefFor 

Fields

Instances

class Monad m => GMutable m f Source #

Minimal complete definition

gThawRef_, gFreezeRef_, gCopyRef_

Instances
(GMutable m f, GMutable m g, PrimMonad m) => GMutable m (f :+: g) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type GRef_ m (f :+: g) = (u :: Type -> Type)

Methods

gThawRef_ :: (f :+: g) a -> m (GRef_ m (f :+: g) a)

gFreezeRef_ :: GRef_ m (f :+: g) a -> m ((f :+: g) a)

gCopyRef_ :: GRef_ m (f :+: g) a -> (f :+: g) a -> m ()

(GMutable m f, GMutable m g) => GMutable m (f :*: g) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type GRef_ m (f :*: g) = (u :: Type -> Type)

Methods

gThawRef_ :: (f :*: g) a -> m (GRef_ m (f :*: g) a)

gFreezeRef_ :: GRef_ m (f :*: g) a -> m ((f :*: g) a)

gCopyRef_ :: GRef_ m (f :*: g) a -> (f :*: g) a -> m ()

Mutable m c => GMutable m (K1 i c :: Type -> Type) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type GRef_ m (K1 i c) = (u :: Type -> Type)

Methods

gThawRef_ :: K1 i c a -> m (GRef_ m (K1 i c) a)

gFreezeRef_ :: GRef_ m (K1 i c) a -> m (K1 i c a)

gCopyRef_ :: GRef_ m (K1 i c) a -> K1 i c a -> m ()

GMutable m f => GMutable m (M1 i c f) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type GRef_ m (M1 i c f) = (u :: Type -> Type)

Methods

gThawRef_ :: M1 i c f a -> m (GRef_ m (M1 i c f) a)

gFreezeRef_ :: GRef_ m (M1 i c f) a -> m (M1 i c f a)

gCopyRef_ :: GRef_ m (M1 i c f) a -> M1 i c f a -> m ()

newtype GRef m a Source #

Constructors

GRef 

Fields

gThawRef :: (Generic a, GMutable m (Rep a)) => a -> m (GRef m a) Source #

gFreezeRef :: (Generic a, GMutable m (Rep a)) => GRef m a -> m a Source #

gCopyRef :: (Generic a, GMutable m (Rep a)) => GRef m a -> a -> m () Source #

newtype RecRef m f a Source #

Constructors

RecRef 

Fields

newtype MR s n a Source #

Mutable ref for hmatrix's statically sized vector types, R and C.

Constructors

MR 

Fields

newtype ML s n k a Source #

Mutable ref for hmatrix's statically sized matrix types, L and M.

Constructors

ML 

Fields

ReMutable

reMutable :: forall m n a r. (Mutable m a, Monad n) => (forall x. m x -> n x) -> (Mutable n a => r) -> r Source #

If you can provice a natural transformation from m to n, you should be able to use a value as if it had Mutable n a if you have Mutable m a.

reMutableConstraint :: forall m n a. (Mutable m a, Monad n) => (forall x. m x -> n x) -> Mutable m a :- Mutable n a Source #

If you can provice a natural transformation from m to n, then Mutable m a should also imply Mutable n a.

newtype ReMutable (s :: Type) m a Source #

Constructors

ReMutable a 
Instances
(Monad n, Mutable m a, Reifies s (ReMutableTrans m n)) => Mutable n (ReMutable s m a) Source # 
Instance details

Defined in Numeric.Opto.Ref

Associated Types

type Ref n (ReMutable s m a) = (v :: Type) Source #

Methods

thawRef :: ReMutable s m a -> n (Ref n (ReMutable s m a)) Source #

freezeRef :: Ref n (ReMutable s m a) -> n (ReMutable s m a) Source #

copyRef :: Ref n (ReMutable s m a) -> ReMutable s m a -> n () Source #

modifyRef :: Ref n (ReMutable s m a) -> (ReMutable s m a -> ReMutable s m a) -> n () Source #

modifyRef' :: Ref n (ReMutable s m a) -> (ReMutable s m a -> ReMutable s m a) -> n () Source #

updateRef :: Ref n (ReMutable s m a) -> (ReMutable s m a -> (ReMutable s m a, b)) -> n b Source #

updateRef' :: Ref n (ReMutable s m a) -> (ReMutable s m a -> (ReMutable s m a, b)) -> n b Source #

type Ref n (ReMutable s m a) Source # 
Instance details

Defined in Numeric.Opto.Ref

type Ref n (ReMutable s m a) = ReMutable s m (Ref m a)

newtype ReMutableTrans m n Source #

Constructors

RMT 

Fields

  • runRMT :: forall x. m x -> n x