syntactic-1.11: Generic abstract syntax, and utilities for embedded languages

Safe HaskellNone

Language.Syntactic.Sharing.Reify

Description

Reifying the sharing in an AST

This module is based on the paper Type-Safe Observable Sharing in Haskell (Andy Gill, 2009, http://dx.doi.org/10.1145/1596638.1596653).

Synopsis

Documentation

reifyGraphSource

Arguments

:: Constrained dom 
=> (forall a. ASTF dom a -> Bool)

A function that decides whether a given node can be shared

-> ASTF dom a 
-> IO (ASG dom a) 

Convert a syntax tree to a sharing-preserving graph

This function is not referentially transparent (hence the IO). However, it is well-behaved in the sense that the worst thing that could happen is that sharing is lost. It is not possible to get false sharing.