Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
See https://github.com/input-output-hk/cardano-engineering-handbook/blob/main/CODE-OF-CONDUCT.md
See the [code of conduct file in the Cardano engineering handbook](https://github.com/input-output-hk/cardano-engineering-handbook/blob/main/CODE-OF-CONDUCT.md).
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Contributing

See [the contributing file in the `ouroboros-network` repository](
https://github.com/input-output-hk/ouroboros-network/blob/master/CONTRIBUTING.md).
We follow consensus guidelines where consensus and network diverge.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
[![Haskell CI](https://img.shields.io/github/actions/workflow/status/input-output-hk/anti-diffs/haskell.yml?label=Build&style=for-the-badge)](https://github.com/input-output-hk/anti-diffs/actions/workflows/haskell.yml)
[![handbook](https://img.shields.io/badge/policy-Cardano%20Engineering%20Handbook-informational?style=for-the-badge)](https://input-output-hk.github.io/cardano-engineering-handbook)

# anti-diffs

Packages for sequences of `Data.Map` differences.
Packages for performant sequences of `Data.Map` differences.

We follow processes and guidelines as established by the Consensus team at IOG.
A nice starting point for reading `ouroboros-consensus` documentation is
[ouroboros-network/ouroboros-consensus/README.md](
https://github.com/input-output-hk/ouroboros-network/blob/master/ouroboros-consensus/README.md).


## Usage

Below is a simple example of defining a sequence of differences using
root-measured finger trees and diffs. For more in-depth information about
root-measured finger trees and diffs, read the following two READMEs. It is
recommended to read them in order, because the documentation of `fingertree-rm`
will justify choices and goals for `diff-containers`.

* See [fingertree-rm/README.md](./fingertree-rm/README.md)
* See [diff-containers/README.md](./diff-containers/README.md)

```haskell
import qualified Data.Map.Diff.Strict as Diff
import qualified Data.FingerTree.RootMeasured.Strict as FTRM

-- | A sequence of differences as a root-measured finger tree, storing the total
-- sum of diffs at the root, and the length of sub-sequences in each node of the
-- finger tree tree.
type DiffSeq k v = FTRM.StrictFingerTree (Diff k v) (Sum Int) (Diff k v)

instance RootMeasured (Diff k v) (Diff k v) where
measureRoot = id

instance Measured (Diff k v) (Sum Int) where
measure = const 1
```

2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
See the security file in the [Cardano engineering handbook](https://github.com/input-output-hk/cardano-engineering-handbook/blob/main/SECURITY.md).
See the [security file in the Cardano engineering handbook](https://github.com/input-output-hk/cardano-engineering-handbook/blob/main/SECURITY.md).