syntax-tree-0.1.0.0: Typed ASTs

Safe HaskellNone
LanguageHaskell2010

AST.Diff

Synopsis

Documentation

diff :: forall t a b. (Recursively ZipMatch t, RTraversable t) => Tree (Ann a) t -> Tree (Ann b) t -> Tree (Diff a b) t Source #

Compute the difference of two annotated trees.

data Diff a b e Source #

A Knot which represents the difference between two annotated trees. The annotation types also function as tokens to describe which of the two trees a term comes from.

Constructors

CommonSubTree (Ann (a, b) e) 
CommonBody (CommonBody a b e) 
Different (Product (Ann a) (Ann b) e) 
Instances
Constraints (Diff a b e) Eq => Eq (Diff a b e) Source # 
Instance details

Defined in AST.Diff

Methods

(==) :: Diff a b e -> Diff a b e -> Bool #

(/=) :: Diff a b e -> Diff a b e -> Bool #

Constraints (Diff a b e) Ord => Ord (Diff a b e) Source # 
Instance details

Defined in AST.Diff

Methods

compare :: Diff a b e -> Diff a b e -> Ordering #

(<) :: Diff a b e -> Diff a b e -> Bool #

(<=) :: Diff a b e -> Diff a b e -> Bool #

(>) :: Diff a b e -> Diff a b e -> Bool #

(>=) :: Diff a b e -> Diff a b e -> Bool #

max :: Diff a b e -> Diff a b e -> Diff a b e #

min :: Diff a b e -> Diff a b e -> Diff a b e #

Constraints (Diff a b e) Show => Show (Diff a b e) Source # 
Instance details

Defined in AST.Diff

Methods

showsPrec :: Int -> Diff a b e -> ShowS #

show :: Diff a b e -> String #

showList :: [Diff a b e] -> ShowS #

Generic (Diff a b e) Source # 
Instance details

Defined in AST.Diff

Associated Types

type Rep (Diff a b e) :: Type -> Type #

Methods

from :: Diff a b e -> Rep (Diff a b e) x #

to :: Rep (Diff a b e) x -> Diff a b e #

Constraints (Diff a b e) Binary => Binary (Diff a b e) Source # 
Instance details

Defined in AST.Diff

Methods

put :: Diff a b e -> Put #

get :: Get (Diff a b e) #

putList :: [Diff a b e] -> Put #

Constraints (Diff a b e) NFData => NFData (Diff a b e) Source # 
Instance details

Defined in AST.Diff

Methods

rnf :: Diff a b e -> () #

type Rep (Diff a b e) Source # 
Instance details

Defined in AST.Diff

type Rep (Diff a b e) = D1 (MetaData "Diff" "AST.Diff" "syntax-tree-0.1.0.0-8tfou50n4eQ4Iq1dis9DWN" False) (C1 (MetaCons "CommonSubTree" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ann (a, b) e))) :+: (C1 (MetaCons "CommonBody" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (CommonBody a b e))) :+: C1 (MetaCons "Different" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Product (Ann a) (Ann b) e)))))

_CommonBody :: forall a b e. Prism' (Diff a b e) (CommonBody a b e) Source #

_CommonSubTree :: forall a b e. Prism' (Diff a b e) (Ann (a, b) e) Source #

_Different :: forall a b e. Prism' (Diff a b e) (Product (Ann a) (Ann b) e) Source #

data CommonBody a b e Source #

A Knot which represents two trees which have the same top-level node, but their children may differ.

Constructors

MkCommonBody 

Fields

Instances
Constraints (CommonBody a b e) Eq => Eq (CommonBody a b e) Source # 
Instance details

Defined in AST.Diff

Methods

(==) :: CommonBody a b e -> CommonBody a b e -> Bool #

(/=) :: CommonBody a b e -> CommonBody a b e -> Bool #

Constraints (CommonBody a b e) Ord => Ord (CommonBody a b e) Source # 
Instance details

Defined in AST.Diff

Methods

compare :: CommonBody a b e -> CommonBody a b e -> Ordering #

(<) :: CommonBody a b e -> CommonBody a b e -> Bool #

(<=) :: CommonBody a b e -> CommonBody a b e -> Bool #

(>) :: CommonBody a b e -> CommonBody a b e -> Bool #

(>=) :: CommonBody a b e -> CommonBody a b e -> Bool #

max :: CommonBody a b e -> CommonBody a b e -> CommonBody a b e #

min :: CommonBody a b e -> CommonBody a b e -> CommonBody a b e #

Constraints (CommonBody a b e) Show => Show (CommonBody a b e) Source # 
Instance details

Defined in AST.Diff

Methods

showsPrec :: Int -> CommonBody a b e -> ShowS #

show :: CommonBody a b e -> String #

showList :: [CommonBody a b e] -> ShowS #

Generic (CommonBody a b e) Source # 
Instance details

Defined in AST.Diff

Associated Types

type Rep (CommonBody a b e) :: Type -> Type #

Methods

from :: CommonBody a b e -> Rep (CommonBody a b e) x #

to :: Rep (CommonBody a b e) x -> CommonBody a b e #

Constraints (CommonBody a b e) Binary => Binary (CommonBody a b e) Source # 
Instance details

Defined in AST.Diff

Methods

put :: CommonBody a b e -> Put #

get :: Get (CommonBody a b e) #

putList :: [CommonBody a b e] -> Put #

Constraints (CommonBody a b e) NFData => NFData (CommonBody a b e) Source # 
Instance details

Defined in AST.Diff

Methods

rnf :: CommonBody a b e -> () #

type Rep (CommonBody a b e) Source # 
Instance details

Defined in AST.Diff

type Rep (CommonBody a b e) = D1 (MetaData "CommonBody" "AST.Diff" "syntax-tree-0.1.0.0-8tfou50n4eQ4Iq1dis9DWN" False) (C1 (MetaCons "MkCommonBody" PrefixI True) (S1 (MetaSel (Just "_anns") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (a, b)) :*: S1 (MetaSel (Just "_val") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (e # Diff a b))))

anns :: forall a b e. Lens' (CommonBody a b e) (a, b) Source #

val :: forall a b e e. Lens (CommonBody a b e) (CommonBody a b e) ((#) e (Diff a b)) ((#) e (Diff a b)) Source #

foldDiffs :: forall r k a b. (Monoid r, Recursively KFoldable k) => (forall n. KRecWitness k n -> Tree (Ann a) n -> Tree (Ann b) n -> r) -> Tree (Diff a b) k -> r Source #

data DiffP k Source #

Instances
Constraints (DiffP k) Eq => Eq (DiffP k) Source # 
Instance details

Defined in AST.Diff

Methods

(==) :: DiffP k -> DiffP k -> Bool #

(/=) :: DiffP k -> DiffP k -> Bool #

Constraints (DiffP k) Ord => Ord (DiffP k) Source # 
Instance details

Defined in AST.Diff

Methods

compare :: DiffP k -> DiffP k -> Ordering #

(<) :: DiffP k -> DiffP k -> Bool #

(<=) :: DiffP k -> DiffP k -> Bool #

(>) :: DiffP k -> DiffP k -> Bool #

(>=) :: DiffP k -> DiffP k -> Bool #

max :: DiffP k -> DiffP k -> DiffP k #

min :: DiffP k -> DiffP k -> DiffP k #

Constraints (DiffP k) Show => Show (DiffP k) Source # 
Instance details

Defined in AST.Diff

Methods

showsPrec :: Int -> DiffP k -> ShowS #

show :: DiffP k -> String #

showList :: [DiffP k] -> ShowS #

Generic (DiffP k) Source # 
Instance details

Defined in AST.Diff

Associated Types

type Rep (DiffP k) :: Type -> Type #

Methods

from :: DiffP k -> Rep (DiffP k) x #

to :: Rep (DiffP k) x -> DiffP k #

Constraints (DiffP k) Binary => Binary (DiffP k) Source # 
Instance details

Defined in AST.Diff

Methods

put :: DiffP k -> Put #

get :: Get (DiffP k) #

putList :: [DiffP k] -> Put #

Constraints (DiffP k) NFData => NFData (DiffP k) Source # 
Instance details

Defined in AST.Diff

Methods

rnf :: DiffP k -> () #

type Rep (DiffP k) Source # 
Instance details

Defined in AST.Diff

_CommonBodyP :: forall k. Prism' (DiffP k) ((#) k DiffP) Source #

foldDiffsP :: forall r k. (Monoid r, Recursively KFoldable k, Recursively KHasPlain k) => (forall n. KHasPlain n => KRecWitness k n -> KPlain n -> KPlain n -> r) -> Tree DiffP k -> r Source #