Copyright | (c) Sebastian Graf 2017-2020 |
---|---|

License | ISC |

Maintainer | sgraf1337@gmail.com |

Portability | portable |

Safe Haskell | None |

Language | Haskell2010 |

Provides an alternative method (to `MonadDependency`

/Datafix.Explicit)
of formulating data-flow problems as a `Denotation`

built in the context of
`MonadDatafix`

. This offers better usability for defining static analyses,
as the problem of allocating nodes in the data-flow graph is abstracted from
the user.

## Synopsis

- class (Monad m, MonadDomain (DepM m)) => MonadDatafix m where
- type DepM m :: * -> *
- datafix :: dom ~ Domain (DepM m) => ChangeDetector dom -> (LiftedFunc dom (DepM m) -> m (a, LiftedFunc dom (DepM m))) -> m a

- datafixEq :: forall m dom a. MonadDatafix m => dom ~ Domain (DepM m) => Eq (ReturnType dom) => (LiftedFunc dom (DepM m) -> m (a, LiftedFunc dom (DepM m))) -> m a
- type Denotation domain func = forall m. (MonadDatafix m, domain ~ Domain (DepM m)) => m (LiftedFunc func (DepM m))

# Documentation

class (Monad m, MonadDomain (DepM m)) => MonadDatafix m where Source #

Builds on an associated `DepM`

that is a `MonadDomain`

(like any
`MonadDependency`

) by providing a way to track dependencies without explicit
`Node`

management. Essentially, this allows to specify a build plan for a
`DataFlowFramework`

through calls to `datafix`

in analogy to `fix`

or `mfix`

.

type DepM m :: * -> * Source #

The monad in which data dependencies are expressed.
Can and will be instantiated to some `MonadDependency`

, if you choose
to go through `FrameworkBuilder`

.

datafix :: dom ~ Domain (DepM m) => ChangeDetector dom -> (LiftedFunc dom (DepM m) -> m (a, LiftedFunc dom (DepM m))) -> m a Source #

This is the closest we can get to an actual fixed-point combinator.

We need to provide a `ChangeDetector`

for detecting the fixed-point as
well as a function to be iterated. In addition to returning a better
approximation of itself in terms of itself, it can return an arbitrary
value of type `a`

. Because the iterated function might want to `datafix`

additional times (think of nested let bindings), the return values are
wrapped in `m`

.

Finally, the arbitrary `a`

value is returned, in analogy to `a`

in

.`mfix`

:: MonadFix m => (a -> m a) -> m a

## Instances

MonadDependency m => MonadDatafix (FrameworkBuilder m) Source # | |

Defined in Datafix.FrameworkBuilder datafix :: dom ~ Domain (DepM (FrameworkBuilder m)) => ChangeDetector dom -> (LiftedFunc dom (DepM (FrameworkBuilder m)) -> FrameworkBuilder m (a, LiftedFunc dom (DepM (FrameworkBuilder m)))) -> FrameworkBuilder m a Source # |

datafixEq :: forall m dom a. MonadDatafix m => dom ~ Domain (DepM m) => Eq (ReturnType dom) => (LiftedFunc dom (DepM m) -> m (a, LiftedFunc dom (DepM m))) -> m a Source #

Shorthand that partially applies `datafix`

to an `eqChangeDetector`

.

type Denotation domain func = forall m. (MonadDatafix m, domain ~ Domain (DepM m)) => m (LiftedFunc func (DepM m)) Source #

A denotation of some syntactic entity in a semantic `domain`

, built in a
some `MonadDatafix`

context.