agreeing: Idiomatic data structure for agreement

[ bsd3, data, library ] [ Propose Tags ]

Please see the README on GitHub at

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS],,,
Change log
Dependencies base (>=4.7 && <5) [details]
License BSD-3-Clause
Copyright 2023 James Cranch
Author James Cranch
Category Data
Home page
Bug tracker
Source repo head: git clone
Uploaded by jcranch at 2023-11-06T00:38:11Z
Distributions LTSHaskell:, NixOS:, Stackage:
Downloads 172 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-11-06 [all 1 reports]

Readme for agreeing-

[back to package description]


A simple data structure helping us ask questions of the following sort: "does all this data have the same /BLANK/ and if so what is it?"

For example:

    doTheseHaveTheSameLength :: [String] -> String
    doTheseHaveTheSameLength l = case foldMap (Somebody . length) of
      Somebody n -> "They all have length " <> show n
      Nobody     -> "The lengths differ"
      Anybody    -> "You didn't give me any strings"

This can of course be done with Maybe (Maybe x) instead, but doing so runs the risk of getting confused: which is Nothing and which is Just Nothing?