reference-counting-0.1.0.0: A reference counting library to alias linear resources
Safe HaskellNone
LanguageGHC2021

Data.Linear.Alias.Internal

Synopsis

Documentation

data Alias (m :: Type -> Type) a where Source #

A reference counted alias

Constructors

Alias 

Fields

  • :: forall a (m :: Type -> Type). (a %1 -> m ())

    Function to free resource when the last alias is forgotten

  • -> !Counter

    The counter associated to this reference counted alias

  • -> a

    The aliased resource

  • -> Alias m a
     

Instances

Instances details
Forgettable μ (Alias μ a) Source # 
Instance details

Defined in Data.Linear.Alias

Methods

forget :: Alias μ a %1 -> μ () Source #

Shareable m (Alias μ a) Source # 
Instance details

Defined in Data.Linear.Alias

Methods

share :: Alias μ a %1 -> m (Alias μ a, Alias μ a) Source #

Fields (K1 i (Alias m a) :: k -> Type) Source # 
Instance details

Defined in Data.Linear.Alias.Internal

Methods

fields :: forall (a0 :: k). K1 i (Alias m a) a0 -> [SomeAlias] Source #

countedFields :: (Generic a, Fields (Rep a)) => a -> [SomeAlias] Source #

Return all reference counted (recursively nested) fields of a. These are not only Aliases directly, but all the recursively nested Aliases in a.

data SomeAlias Source #

Constructors

SomeAlias (Alias m b) 

class Fields (rep :: k -> Type) where Source #

Methods

fields :: forall (a :: k). rep a -> [SomeAlias] Source #

Instances

Instances details
Fields (U1 :: k -> Type) Source # 
Instance details

Defined in Data.Linear.Alias.Internal

Methods

fields :: forall (a :: k). U1 a -> [SomeAlias] Source #

Fields (V1 :: k -> Type) Source # 
Instance details

Defined in Data.Linear.Alias.Internal

Methods

fields :: forall (a :: k). V1 a -> [SomeAlias] Source #

(Fields a, Fields b) => Fields (a :*: b :: k -> Type) Source # 
Instance details

Defined in Data.Linear.Alias.Internal

Methods

fields :: forall (a0 :: k). (a :*: b) a0 -> [SomeAlias] Source #

(Fields a, Fields b) => Fields (a :+: b :: k -> Type) Source # 
Instance details

Defined in Data.Linear.Alias.Internal

Methods

fields :: forall (a0 :: k). (a :+: b) a0 -> [SomeAlias] Source #

Fields (K1 i (Alias m a) :: k -> Type) Source # 
Instance details

Defined in Data.Linear.Alias.Internal

Methods

fields :: forall (a0 :: k). K1 i (Alias m a) a0 -> [SomeAlias] Source #

Fields f => Fields (M1 i c f :: k -> Type) Source # 
Instance details

Defined in Data.Linear.Alias.Internal

Methods

fields :: forall (a :: k). M1 i c f a -> [SomeAlias] Source #