reverse-arguments: Reverse the arguments of arbitrary functions.

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]

This module provides the reverseArgs function which flips the arguments of a function of arbitrary arity. The return value of the flipped function can not be fully polymorphic as this could imply it is a function.

Example:

myFlip :: (a -> b -> c -> d -> [e]) -> d -> c -> b -> a -> [e]
myFlip = reverseArgs

However, if you supply a proof (of the form IsFun a ~ 'False) that a is not a function, you can also return a polymorphic type.

Example:

myFlip :: IsFun e ~ 'False => (a -> b -> c -> d -> e) -> d -> c -> b -> a -> e
myFlip = reverseArgs

[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Dependencies base (>=4.8 && <5) [details]
License BSD-3-Clause
Copyright (c) 2016 Anselm Jonas Scholl
Author Anselm Jonas Scholl
Maintainer anselm.scholl@tu-harburg.de
Category Data
Source repo head: git clone https://github.com/ajscholl/reverse-arguments.git
Uploaded by JonasScholl at 2016-03-25T14:37:26Z
Distributions NixOS:0.1.0.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1177 total (13 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 reverse-arguments-0.1.0.0

[back to package description]

Reversing function arguments

This module provides the reverseArgs function which flips the arguments of a function of arbitrary arity. The return value of the flipped function can not be fully polymorphic as this could imply it is a function.

Example:

myFlip :: (a -> b -> c -> d -> [e]) -> d -> c -> b -> a -> [e]
myFlip = reverseArgs

However, if you supply a proof (of the form IsFun a ~ 'False) that a is not a function, you can also return a polymorphic type.

Example:

myFlip :: IsFun e ~ 'False => (a -> b -> c -> d -> e) -> d -> c -> b -> a -> e
myFlip = reverseArgs