Module

Data.Function.Sub

Package
purescript-substructural
Repository
rightfold/purescript-substructural

#Sub Source

data Sub :: Type -> Type -> Type

A function.

Instances

#type (-*) Source

Operator alias for Data.Function.Sub.Sub (right-associative / precedence 4)

#runShared Source

runShared :: forall b a. Shared a => Shared b => (a -* b) -> a -> b

Run a function over shared values.

#liftShared Source

liftShared :: forall b a. Shared a => Shared b => (a -> b) -> a -* b

Lift a function over shared values into a Sub.

#Clone Source

class Clone a  where

Values which can be cloned. Instances of Clone must satisfy the following laws:

  • Clone: fst' <<< clone = snd' <<< clone = id

Members

Instances

#Drop Source

class Drop a  where

Values which can be dropped.

Members

Instances

#Shared Source

class (Clone a, Drop a) <= Shared a 

Values for which multiple live references can exist. Clone and Drop instances may be no-ops.

Instances

#unsafeClone Source

unsafeClone :: forall a. a -* (Tuple a a)

Unsafely clone a value.

#unsafeDrop Source

unsafeDrop :: forall a. a -* Unit

Unsafely drop a value.

#fst' Source

fst' :: forall b a. Drop b => (Tuple a b) -* a

Drop the second element of a tuple.

#snd' Source

snd' :: forall b a. Drop a => (Tuple a b) -* b

Drop the first element of a tuple.

#Borrow Source

data Borrow :: Type -> Type

A Borrow is a reference to a value. When a borrow to a value is live, the value cannot be accessed unless it is Shared. Some functions take borrows to avoid inconvenient tupling.

Instances

#borrow Source

borrow :: forall b a. Shared b => ((Borrow a) -* b) -> a -* (Tuple a b)

Borrow a value during the execution of a function.