hdiff-0.0.1: Pattern-Expression-based differencing of arbitrary types.

Safe HaskellSafe
LanguageHaskell2010

Data.HDiff.Diff.Types

Synopsis

Documentation

data DiffOpaques Source #

Controls the sharing of opaque values.

Constructors

DO_Never

Never share opaque values

DO_OnSpine

Only share opaque values that appear on the spine.

DO_AsIs

Handle values of type K k normally, as we handle recursive trees, of type I i.

Instances
Eq DiffOpaques Source # 
Instance details

Defined in Data.HDiff.Diff.Types

Show DiffOpaques Source # 
Instance details

Defined in Data.HDiff.Diff.Types

data DiffMode Source #

Diffing Algorithm modes. This is better illustrated with an example. Supposte we have the following source and destination trees:

src = Bin (Bin t k) u
dst = Bin (Bin t k) t

Constructors

DM_ProperShare

The proper share algorithm will only share the trees that are supposed to be a proper share. With the src and dst above, it will produce:

diff src dst = Bin (Bin 0 1) u |-> Bin (Bin 0 1) 0

A good intuition is that this approach will prefer maximum sharing as opposed to sharing bigger trees.

DM_NoNested

The first algoritm we produced. Does not share nested trees. In fact, with this mode we will get the following result:

diff src dst = Bin 0 u |-> Bin 0 t
DM_Patience

Similar to git --patience, we share only unique trees. In this example, this would result in the same as DM_NoNested, but if we take u = (Bin t k), no sharing would be performed whatsoever.

data DiffOptions Source #

Specifies the options for the diffing algorithm

Constructors

DiffOptions

Minimum height of trees considered for sharing

Instances
Eq DiffOptions Source # 
Instance details

Defined in Data.HDiff.Diff.Types

Show DiffOptions Source # 
Instance details

Defined in Data.HDiff.Diff.Types

type IsSharedMap = Trie MetavarAndArity Source #

The data structure that captures which subtrees are shared between source and destination. Besides providing an efficient answer to the query: "is this tree shared?", it also gives a unique identifier to that tree, allowing us to easily build our n-holed treefix.

type MinHeight = Int Source #

A tree smaller than the minimum height will never be shared.