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 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.9 && <4.11) [details]
License LicenseRef-PublicDomain
Author Samuel Gélineau
Maintainer gelisam+github@gmail.com
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 139 total (9 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]
Hackage Matrix CI

Modules

[Index]

Downloads

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.