Copyright | (c) Fumiaki Kinoshita 2017 |
---|---|
License | BSD3 |
Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Mutable structs
- data Struct s h xs
- set :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> h x -> m ()
- get :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> m (h x)
- new :: forall h m xs. (PrimMonad m, Generate xs) => (forall x. Membership xs x -> h x) -> m (Struct (PrimState m) h xs)
- newRepeat :: forall h m xs. (PrimMonad m, Generate xs) => (forall x. h x) -> m (Struct (PrimState m) h xs)
- newFor :: forall proxy c h m xs. (PrimMonad m, Forall c xs) => proxy c -> (forall x. c x => Membership xs x -> h x) -> m (Struct (PrimState m) h xs)
- newFromHList :: forall h m xs. PrimMonad m => HList h xs -> m (Struct (PrimState m) h xs)
- data h :* s
- unsafeFreeze :: PrimMonad m => Struct (PrimState m) h xs -> m (h :* xs)
- newFrom :: forall g h m xs. PrimMonad m => (g :* xs) -> (forall x. Membership xs x -> g x -> h x) -> m (Struct (PrimState m) h xs)
- hlookup :: Membership xs x -> (h :* xs) -> h x
- hlength :: (h :* xs) -> Int
- hfoldrWithIndex :: (forall x. Membership xs x -> h x -> r -> r) -> r -> (h :* xs) -> r
- thaw :: PrimMonad m => (h :* xs) -> m (Struct (PrimState m) h xs)
- hfrozen :: (forall s. ST s (Struct s h xs)) -> h :* xs
- hmodify :: (forall s. Struct s h xs -> ST s ()) -> (h :* xs) -> h :* xs
- toHList :: forall h xs. (h :* xs) -> HList h xs
Mutable struct
set :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> h x -> m () Source #
Write a value in a Struct
.
get :: PrimMonad m => Struct (PrimState m) h xs -> Membership xs x -> m (h x) Source #
Read a value from a Struct
.
new :: forall h m xs. (PrimMonad m, Generate xs) => (forall x. Membership xs x -> h x) -> m (Struct (PrimState m) h xs) Source #
Create a new Struct
using the supplied initializer.
newRepeat :: forall h m xs. (PrimMonad m, Generate xs) => (forall x. h x) -> m (Struct (PrimState m) h xs) Source #
Create a Struct
full of the specified value.
newFor :: forall proxy c h m xs. (PrimMonad m, Forall c xs) => proxy c -> (forall x. c x => Membership xs x -> h x) -> m (Struct (PrimState m) h xs) Source #
Create a new Struct
using the supplied initializer with a context.
newFromHList :: forall h m xs. PrimMonad m => HList h xs -> m (Struct (PrimState m) h xs) Source #
Create a new Struct
from an HList
.
Immutable product
The type of extensible products.
(:*) :: (k -> *) -> [k] -> *
(Corepresentable p, Comonad (Corep p), Functor f) => Extensible k f p ((:*) k) Source # | |
newFrom :: forall g h m xs. PrimMonad m => (g :* xs) -> (forall x. Membership xs x -> g x -> h x) -> m (Struct (PrimState m) h xs) Source #
Create a new Struct
using the contents of a product.
hlookup :: Membership xs x -> (h :* xs) -> h x Source #
Get an element in a product.
hfoldrWithIndex :: (forall x. Membership xs x -> h x -> r -> r) -> r -> (h :* xs) -> r Source #
Right-associative fold of a product.
thaw :: PrimMonad m => (h :* xs) -> m (Struct (PrimState m) h xs) Source #
Create a new Struct
from a product.