agreeing: Idiomatic data structure for agreement

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Please see the README on GitHub at https://github.com/jcranch/agreeing#readme


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.2.3.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5) [details]
License BSD-3-Clause
Copyright 2023 James Cranch
Author James Cranch
Maintainer j.d.cranch@sheffield.ac.uk
Category Data
Home page https://github.com/jcranch/agreement#readme
Bug tracker https://github.com/jcranch/agreement/issues
Source repo head: git clone https://github.com/jcranch/agreement
Uploaded by jcranch at 2023-11-06T00:35:45Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for agreeing-0.2.3.0

[back to package description]

agreeing

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?