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

Data.Linear.Alias.Unsafe

Description

This module is designed to be imported qualified. It provides unsafe operations over the reference counted structures in order to build new primitives wrt linearity.

import qualified Data.Counted.Unsafe as Unsafe
Synopsis

Documentation

inc :: forall m (m' :: Type -> Type) a. MonadIO m => Alias m' a %1 -> m (Alias m' a) Source #

Unsafely increment the counter of some reference counted resource

dec :: forall m (μ :: Type -> Type) a. MonadIO m => Alias μ a %1 -> m (Ur a) Source #

Unsafely decrement the counter of some reference counted resource and get the reference counted value (it's really, really quite unsafe).

This doesn't free the resource if the reference count reaches 0.

get :: forall (m' :: Type -> Type) a. Alias m' a -> a Source #

Unsafely get an aliased value. All counters are kept unchanged.