diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 15fabb8..5ff6fb3 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -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). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 854139a..5420444 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. \ No newline at end of file diff --git a/README.md b/README.md index 117dd9f..9923a7e 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +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 +``` + diff --git a/SECURITY.md b/SECURITY.md index b35604d..1e46f2f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -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).