compdata-dags-0.2: Compositional Data Types on DAGs

Copyright(c) 2014 Patrick Bahr, Emil Axelsson
LicenseBSD3
MaintainerPatrick Bahr <paba@di.ku.dk>
Stabilityexperimental
Portabilitynon-portable (GHC Extensions)
Safe HaskellNone
LanguageHaskell98

Data.Comp.Dag.AG

Description

This module implements the recursion schemes from module Data.Comp.AG on Dags. In order to deal with the sharing present in Dags, the recursion schemes additionally take an argument of type d -> d -> d that resolves clashing inherited attribute values.

Synopsis

Documentation

runAG Source

Arguments

:: Traversable f 
=> (d -> d -> d)

resolution function for inherited attributes

-> Syn' f (u, d) u

semantic function of synthesised attributes

-> Inh' f (u, d) d

semantic function of inherited attributes

-> (u -> d)

initialisation of inherited attributes

-> Dag f

input dag

-> u 

This function runs an attribute grammar on a dag. The result is the (combined) synthesised attribute at the root of the dag.

runRewrite Source

Arguments

:: (Traversable f, Traversable g) 
=> (d -> d -> d)

resolution function for inherited attributes

-> Syn' f (u, d) u

semantic function of synthesised attributes

-> Inh' f (u, d) d

semantic function of inherited attributes

-> Rewrite f (u, d) g

initialisation of inherited attributes

-> (u -> d)

input term

-> Dag f 
-> (u, Dag g) 

This function runs an attribute grammar with rewrite function on a dag. The result is the (combined) synthesised attribute at the root of the dag and the rewritten dag.