htcc-0.0.0.1: The full scratch implementation of tiny C compiler (x86_64)
Copyright(c) roki 2019
LicenseMIT
Maintainerfalgon53@yahoo.co.jp
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Htcc.Utils.Tuple

Description

Utilities of tuple

Synopsis
  • swap :: (a, b) -> (b, a)
  • first3 :: (a -> d) -> (a, b, c) -> (d, b, c)
  • second3 :: (b -> d) -> (a, b, c) -> (a, d, c)
  • third3 :: (c -> d) -> (a, b, c) -> (a, b, d)
  • dropFst3 :: (a, b, c) -> (b, c)
  • dropSnd3 :: (a, b, c) -> (a, c)
  • dropThd3 :: (a, b, c) -> (a, b)
  • fst4 :: (a, b, c, d) -> a
  • snd4 :: (a, b, c, d) -> b
  • thd4 :: (a, b, c, d) -> c
  • fou4 :: (a, b, c, d) -> d
  • first4 :: (a -> e) -> (a, b, c, d) -> (e, b, c, d)
  • second4 :: (b -> e) -> (a, b, c, d) -> (a, e, c, d)
  • third4 :: (c -> e) -> (a, b, c, d) -> (a, b, e, d)
  • fourth4 :: (d -> e) -> (a, b, c, d) -> (a, b, c, e)
  • dropFst4 :: (a, b, c, d) -> (b, c, d)
  • dropSnd4 :: (a, b, c, d) -> (a, c, d)
  • dropThd4 :: (a, b, c, d) -> (a, b, d)
  • dropFourth4 :: (a, b, c, d) -> (a, b, c)
  • curry4 :: ((a, b, c, d) -> e) -> a -> b -> c -> d -> e
  • uncurry4 :: (a -> b -> c -> d -> e) -> (a, b, c, d) -> e

For double

swap :: (a, b) -> (b, a) Source #

Swap a first element and second element

For triples

first3 :: (a -> d) -> (a, b, c) -> (d, b, c) Source #

Update the first component of triple.

second3 :: (b -> d) -> (a, b, c) -> (a, d, c) Source #

Update the second component of triple.

third3 :: (c -> d) -> (a, b, c) -> (a, b, d) Source #

Update the third component of triple.

dropFst3 :: (a, b, c) -> (b, c) Source #

Drop first element of triple and returns pair

dropSnd3 :: (a, b, c) -> (a, c) Source #

Drop second element of triple and returns pair

dropThd3 :: (a, b, c) -> (a, b) Source #

Drop third element of triple and returns pair

For quadruple

fst4 :: (a, b, c, d) -> a Source #

Take first element of quadruple.

snd4 :: (a, b, c, d) -> b Source #

Take second element of quadruple.

thd4 :: (a, b, c, d) -> c Source #

Take third element of quadruple.

fou4 :: (a, b, c, d) -> d Source #

Take fourth element of quadruple.

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

Update first component of quadruple.

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

Update second component of quadruple.

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

Update third component of quadruple.

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

Update fourth component of quadruple.

dropFst4 :: (a, b, c, d) -> (b, c, d) Source #

Drop first element of quadruple.

dropSnd4 :: (a, b, c, d) -> (a, c, d) Source #

Drop second element of quadruple.

dropThd4 :: (a, b, c, d) -> (a, b, d) Source #

Drop third element of quadruple.

dropFourth4 :: (a, b, c, d) -> (a, b, c) Source #

Drop fourth element of quadruple.

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

Converts an uncurried function to a curried function.

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

Converts a curried function to a function on a quadruple.