tree-diff-0.0.1: Diffing of (expression) trees.

Safe HaskellNone
LanguageHaskell2010

Data.TreeDiff.Expr

Contents

Description

This module uses Expr for richer diffs than based on Tree.

Synopsis

Types

data Expr #

A untyped Haskell-like expression.

Having richer structure than just Tree allows to have richer diffs.

Constructors

App ConstructorName [Expr]

application

Rec ConstructorName (Map FieldName Expr)

record constructor

Lst [Expr]

list constructor

Instances

Eq Expr # 

Methods

(==) :: Expr -> Expr -> Bool #

(/=) :: Expr -> Expr -> Bool #

Show Expr # 

Methods

showsPrec :: Int -> Expr -> ShowS #

show :: Expr -> String #

showList :: [Expr] -> ShowS #

Arbitrary Expr # 

Methods

arbitrary :: Gen Expr #

shrink :: Expr -> [Expr] #

ToExpr Expr # 

Methods

toExpr :: Expr -> Expr #

listToExpr :: [Expr] -> Expr #

type ConstructorName = String #

Constructor name is a string

type FieldName = String #

Record field name is a string too.

data EditExpr #

Type used in the result of ediff.

Instances

data Edit a #

List edit operations

The Swp constructor is redundant, but it let us spot a recursion point when performing tree diffs.

Constructors

Ins a

insert

Del a

delete

Cpy a

copy unchanged

Swp a a

swap, i.e. delete + insert

Instances

Show a => Show (Edit a) # 

Methods

showsPrec :: Int -> Edit a -> ShowS #

show :: Edit a -> String #

showList :: [Edit a] -> ShowS #

exprDiff :: Expr -> Expr -> Edit EditExpr #

Diff two Expr.

For examples see ediff in Data.TreeDiff.Class.