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]

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


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.0
Change logCHANGELOG.md
Dependenciesbase (>=4.9 && <4.11) [details]
LicenseLicenseRef-PublicDomain
AuthorSamuel Gélineau
Maintainergelisam+github@gmail.com
CategoryData
Home pagehttps://github.com/gelisam/n-ary-functor
UploadedSat Jan 6 22:26:34 UTC 2018 by gelisam

Modules

[Index]

Downloads

Maintainers' 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.