darcs-2.8.4: a distributed, interactive, smart revision control system

Safe Haskell | None

Darcs.Witnesses.Eq

Synopsis

- data EqCheck a b where
  - IsEq :: EqCheck a a
  - NotEq :: EqCheck a b
- class MyEq p where
  - unsafeCompare :: p a b -> p c d -> Bool
  - (=\/=) :: p a b -> p a c -> EqCheck b c
  - (=/\=) :: p a c -> p b c -> EqCheck a b
- isIsEq :: EqCheck a b -> Bool

# Documentation

data EqCheck a b where

`EqCheck` is used to pass around evidence (or lack thereof) of two witness types being equal.

Constructors

IsEq :: EqCheck a a |
NotEq :: EqCheck a b |

Instances

Eq (EqCheck a b) |
Show (EqCheck a b) |

class MyEq p where

An witness aware equality class. A minimal definition defines any one of `unsafeCompare`, `=\/=` and `=/\=`.

Methods

unsafeCompare :: p a b -> p c d -> Bool

It is unsafe to define a class instance via this method, because if it returns True then the default implementations of `=\/=` and `=/\=` will coerce the equality of two witnesses.

Calling this method is safe, although `=\/=` or `=/\=` would be better choices as it is not usually meaningul to compare two patches that don't share either a starting or an ending context

(=\/=) :: p a b -> p a c -> EqCheck b c

Compare two things with the same starting witness. If the things compare equal, evidence of the ending witnesses being equal will be returned.

(=/\=) :: p a c -> p b c -> EqCheck a b

Compare two things with the same ending witness. If the things compare equal, evidence of the starting witnesses being equal will be returned.

Instances

MyEq DirPatchType |
MyEq FilePatchType |
MyEq Prim |
MyEq Prim |
MyEq Hunk |
MyEq DummyPatch |
MyEq WPatchInfo |
(MyEq p, Commute p) => MyEq (RL p) |
(MyEq p, Commute p) => MyEq (FL p) |
MyEq prim => MyEq (Patch prim) |
(Commute p, MyEq p) => MyEq (Named p) |
(Commute p, MyEq p) => MyEq (PatchInfoAnd p) |
MyEq p => MyEq (TaggedPatch p) |
PrimPatch prim => MyEq (RealPatch prim) |
(MyEq a, MyEq b) => MyEq (:< a b) |
(MyEq a, MyEq b) => MyEq (:> a b) |

isIsEq :: EqCheck a b -> Bool