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

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]

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


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.0, 1.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 2018-01-06T22:26:34Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

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.