datafix-0.0.0.2: Fixing data-flow problems

Datafix.NodeAllocator

Description

Helpers for allocating Nodes in an ergonomic manner, e.g. taking care to get mfix right under the hood for allocation in recursive bindings groups through the key primitive allocateNode.

Synopsis

# Documentation

data NodeAllocator v a Source #

A state monad wrapping a mapping from Node to some v which we will instantiate to appropriate LiftedFuncs.

Instances

 Source # Methods(>>=) :: NodeAllocator v a -> (a -> NodeAllocator v b) -> NodeAllocator v b #(>>) :: NodeAllocator v a -> NodeAllocator v b -> NodeAllocator v b #return :: a -> NodeAllocator v a #fail :: String -> NodeAllocator v a # Source # Methodsfmap :: (a -> b) -> NodeAllocator v a -> NodeAllocator v b #(<\$) :: a -> NodeAllocator v b -> NodeAllocator v a # Source # Methodspure :: a -> NodeAllocator v a #(<*>) :: NodeAllocator v (a -> b) -> NodeAllocator v a -> NodeAllocator v b #liftA2 :: (a -> b -> c) -> NodeAllocator v a -> NodeAllocator v b -> NodeAllocator v c #(*>) :: NodeAllocator v a -> NodeAllocator v b -> NodeAllocator v b #(<*) :: NodeAllocator v a -> NodeAllocator v b -> NodeAllocator v a #

allocateNode :: (Node -> NodeAllocator v (a, v)) -> NodeAllocator v a Source #

Allocates the next Node, which is greater than any nodes requested before.

The value stored at that node is the result of a NodeAllocator computation which may already access the Node associated with that value. This is important for the case of recursive let, where the denotation of an expression depends on itself.

runAllocator :: NodeAllocator v a -> (a, Array v) Source #

Runs the allocator, beginning with an empty mapping.