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]
Versions [faq] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.9 && <5) [details]
License LicenseRef-PublicDomain
Author Samuel Gélineau
Maintainer gelisam+github@gmail.com
Revised Revision 1 made by gelisam at Sun Mar 10 19:00:27 UTC 2019
Category Data
Home page https://github.com/gelisam/n-ary-functor
Uploaded by gelisam at Sat Jan 6 22:27:29 UTC 2018
Distributions NixOS:0.1.0.0
Downloads 361 total (25 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]

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

For package maintainers and hackage trustees


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.