delta-types: Delta types, also known as change actions.

[ apache, data-structures, library ] [ Propose Tags ] [ Report a vulnerability ]

A delta type da for a base type a is a collection of values, each of which corresponds to a change a → a of the base type.

See also


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
release

Enable optimization and `-Werror`

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0.0
Change log CHANGELOG.md
Dependencies base (>=4.14 && <5), containers (>=0.5 && <0.9), semigroupoids (>=6.0.1 && <6.1) [details]
Tested with ghc ==8.10.7 || ==9.6.6 || ==9.10.1
License Apache-2.0
Copyright 2021-2023 IOHK, 2024-2025 Cardano Foundation
Author Cardano Foundation (High Assurance Lab)
Maintainer hal@cardanofoundation.org
Category Data Structures
Home page https://github.com/cardano-foundation/delta-types
Uploaded by HeinrichApfelmus at 2025-03-27T16:09:58Z
Distributions Stackage:1.0.0.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 4 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2025-03-27 [all 1 reports]

Readme for delta-types-1.0.0.0

[back to package description]

Overview

This package provides a notion of delta types via the Delta typeclass.

A delta type da for a base type a is a collection of values that each correspond to a change a → a of the base type. The following typeclass captures this correspondence:

class Delta da where
    type Base da = a
    apply :: da → (a → a)

In the literature, this concept is also known as a change action, with relations to incremental computation and differential lambda calculus. See References.

For example, one delta type for Set a is given by

data DeltaSet1 a = Insert a | Delete a

instance Delta (DeltaSet1 a) where
    type Base (DeltaSet1 a) = Set a
    apply (Insert a) = Data.Set.insert a
    apply (Delete a) = Date.Set.delete a

In general, there may be multiple delta types associated with a single base type.

References

  1. Alvarez-Picallo, M., Eyers-Taylor, A., Peyton Jones, M., Ong, CH.L. (2019). Fixing Incremental Computation. In: Caires, L. (eds) Programming Languages and Systems. ESOP 2019. Lecture Notes in Computer Science(), vol 11423. Springer, Cham.
  2. M. Alvarez-Picallo, M. (2020). Change actions: from incremental computation to discrete derivatives. PhD thesis, Oxford.
  3. Apfelmus, H. (2023). Delta encodings help separate business logic from database operations. Bobkonf 2023, Berlin.