flippers-1.0.1: Variations on flip for multiple arguments
Copyright(c) Christian Marie 2014
LicenseBSD3
Maintainerchristian@ponies.io
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Function.Flippers

Description

This module provides functions to rearrange arguments, such as rotate4 and flip4. Compose them to achive whatever ordering you like.

Synopsis
  • rotate1 :: (a -> b) -> a -> b
  • rotate2 :: (a -> b -> c) -> b -> a -> c
  • rotate3 :: (a -> b -> c -> d) -> c -> a -> b -> d
  • rotate4 :: (a -> b -> c -> d -> e) -> d -> a -> b -> c -> e
  • rotate5 :: (a -> b -> c -> d -> e -> f) -> e -> a -> b -> c -> d -> f
  • rotate6 :: (a -> b -> c -> d -> e -> f -> g) -> f -> a -> b -> c -> d -> e -> g
  • rotate7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> g -> a -> b -> c -> d -> e -> f -> h
  • rotate8 :: (a -> b -> c -> d -> e -> f -> g -> h -> i) -> h -> a -> b -> c -> d -> e -> f -> g -> i
  • rotate9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> i -> a -> b -> c -> d -> e -> f -> g -> h -> j
  • flip1 :: (a -> b) -> a -> b
  • flip2 :: (a -> b -> c) -> b -> a -> c
  • flip3 :: (a -> b -> c -> d) -> c -> b -> a -> d
  • flip4 :: (a -> b -> c -> d -> e) -> d -> c -> b -> a -> e
  • flip5 :: (a -> b -> c -> d -> e -> f) -> e -> d -> c -> b -> a -> f
  • flip6 :: (a -> b -> c -> d -> e -> f -> g) -> f -> e -> d -> c -> b -> a -> g
  • flip7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> g -> f -> e -> d -> c -> b -> a -> h
  • flip8 :: (a -> b -> c -> d -> e -> f -> g -> h -> i) -> h -> g -> f -> e -> d -> c -> b -> a -> i
  • flip9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> i -> h -> g -> f -> e -> d -> c -> b -> a -> j

Rotation

Rotate all arguments right one position

rotate1 :: (a -> b) -> a -> b Source #

Does nothing, id

rotate2 :: (a -> b -> c) -> b -> a -> c Source #

Move the second argument to the first place

rotate3 :: (a -> b -> c -> d) -> c -> a -> b -> d Source #

Move the third argument to the first place

rotate4 :: (a -> b -> c -> d -> e) -> d -> a -> b -> c -> e Source #

Move the fourth argument to the first place

rotate5 :: (a -> b -> c -> d -> e -> f) -> e -> a -> b -> c -> d -> f Source #

Move the fifth argument to the first place

rotate6 :: (a -> b -> c -> d -> e -> f -> g) -> f -> a -> b -> c -> d -> e -> g Source #

Move the sixth argument to the first place

rotate7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> g -> a -> b -> c -> d -> e -> f -> h Source #

Move the seventh argument to the first place

rotate8 :: (a -> b -> c -> d -> e -> f -> g -> h -> i) -> h -> a -> b -> c -> d -> e -> f -> g -> i Source #

Move the eight argument to the first place

rotate9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> i -> a -> b -> c -> d -> e -> f -> g -> h -> j Source #

Move the ninth argument to the first place

Flipping

Reverse the order of all arguments

flip1 :: (a -> b) -> a -> b Source #

Does nothing, id

flip2 :: (a -> b -> c) -> b -> a -> c Source #

Reverse both arguments, same as rotate2

flip3 :: (a -> b -> c -> d) -> c -> b -> a -> d Source #

Reverse three arguments

flip4 :: (a -> b -> c -> d -> e) -> d -> c -> b -> a -> e Source #

Reverse four arguments

flip5 :: (a -> b -> c -> d -> e -> f) -> e -> d -> c -> b -> a -> f Source #

Reverse five arguments

flip6 :: (a -> b -> c -> d -> e -> f -> g) -> f -> e -> d -> c -> b -> a -> g Source #

Reverse six arguments

flip7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> g -> f -> e -> d -> c -> b -> a -> h Source #

Reverse seven arguments

flip8 :: (a -> b -> c -> d -> e -> f -> g -> h -> i) -> h -> g -> f -> e -> d -> c -> b -> a -> i Source #

Reverse eight arguments

flip9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> i -> h -> g -> f -> e -> d -> c -> b -> a -> j Source #

Reverse nine arguments