Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

hackage.haskell.org : pa-label

[Index] [Quick Jump] Package maintainers For package maintainers and hackage trustees Candidates One-module library to provide nice anonymous labelled tuples and enums. If you have a function: what do you do? At call-site you don’t see the names of any of the types. Before GHC 9.2, one strategy would have been to create a newtype for every single argument: but that is very verbose and leaks into global scope! Instead, do this: then it becomes clear to the call-site, what to do. In the function you can access the labels with record dots to get to the inner types, e.g. username.username, read.read. Even better, you can bundle things into anonymous tuples: and access inside the function like user.username or permission.read. So much nicer! We provide tuples up to size 3, for anything bigger the you should really just create a normal record with data. The great thing is that no use-site has to be adjusted as long as you name the record fields the same and use record-dot syntax everywhere. There’s some experimental support for anonymous enums (E2/E3), they are useful in some situations, but not as often as anonymous tuples in our experience. Approaches like vinyl or superrecord are more general, but very hard to understand and lead to bad error messages. We have found that in practice it is nicer to use the a lot less magical and slightly more verbose T2/T3 and switch to normal records once you reach 4 fields.

Registry - Source - JSON
purl: pkg:hackage/pa-label
Keywords: bsd3, data, library, possehl-analytics
License: BSD-3-Clause
Latest release: 2 months ago
First release: 12 months ago
Dependent packages: 1
Downloads: 94 total
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 29 days ago

    Loading...
    Readme
    Loading...