n-ary-functor: An n-ary version of Functor

[ data, library, public-domain ] [ Propose Tags ]

A single typeclass for Functor, Bifunctor, Trifunctor, etc.


[Skip to Readme]

Modules

[Index]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 1.0
Change log CHANGELOG.md
Dependencies base (>=4.9 && <4.14) [details]
License LicenseRef-PublicDomain
Author Samuel Gélineau
Maintainer gelisam+github@gmail.com
Revised Revision 2 made by gelisam at 2021-04-04T14:04:24Z
Category Data
Home page https://github.com/gelisam/n-ary-functor
Uploaded by gelisam at 2018-01-06T22:27:29Z
Distributions NixOS:1.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1491 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for n-ary-functor-0.1.0.0

[back to package description]

N-ary Functors

Functor and Bifunctor are both in base, but what about Trifunctor? Quadrifunctor? There must be a better solution than creating an infinite tower of typeclasses. Here's the API I managed to implement:

> nmap <#> (+1) <#> (+2) $ (0, 0)
(1,2)

> nmap <#> (+1) <#> (+2) <#> (+3) $ (0, 0, 0)
(1,2,3)

> nmap <#> (+1) <#> (+2) <#> (+3) <#> (+4) $ (0, 0, 0, 0)
(1,2,3,4)

For more details, see the documentation and the blog post.