generic-diff-instances
Safe HaskellSafe-Inferred
LanguageHaskell2010

Generics.Diff.Special.Tree

Description

A worked example of implementing SpecialDiff (and thereby Diff) for Trees.

As with other 3rd-party types, there are different approaches we can take here. We'll show 2 of them:

Synopsis

Documentation

newtype CustomTree a Source #

A newtype wrapper around Tree to demonstrate one alternate way we could hand-write a SpecialDiff instance.

Constructors

CustomTree (Tree a) 

Instances

Instances details
Show a => Show (CustomTree a) Source # 
Instance details

Defined in Generics.Diff.Special.Tree

Diff a => Diff (CustomTree a) Source # 
Instance details

Defined in Generics.Diff.Special.Tree

Diff a => SpecialDiff (CustomTree a) Source # 
Instance details

Defined in Generics.Diff.Special.Tree

Associated Types

type SpecialDiffError (CustomTree a) #

type SpecialDiffError (CustomTree a) Source # 
Instance details

Defined in Generics.Diff.Special.Tree

newtype TreePath Source #

Where are we in the tree? Each element of the list says which child node we step to next.

Constructors

TreePath [Int] 

Instances

Instances details
Show TreePath Source # 
Instance details

Defined in Generics.Diff.Special.Tree

Eq TreePath Source # 
Instance details

Defined in Generics.Diff.Special.Tree

renderTreePath :: TreePath -> Builder Source #

Render a tree path as a Builder

Orphan instances

Diff a => Diff (Tree a) Source # 
Instance details

Methods

diff :: Tree a -> Tree a -> DiffResult (Tree a) #

diffList :: [Tree a] -> [Tree a] -> DiffResult [Tree a] #

Diff a => SpecialDiff (Tree a) Source #

Generically-derived instance.

Instance details

Associated Types

type SpecialDiffError (Tree a) #