mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-10 05:39:31 +03:00
lib: currying helpers
This commit is contained in:
parent
de9df350b4
commit
4beb416070
@ -93,6 +93,27 @@ fourth6 (_,_,_,x,_,_) = x
|
||||
fifth6 (_,_,_,_,x,_) = x
|
||||
sixth6 (_,_,_,_,_,x) = x
|
||||
|
||||
-- currying
|
||||
|
||||
|
||||
curry2 :: ((a, b) -> c) -> a -> b -> c
|
||||
curry2 f x y = f (x, y)
|
||||
|
||||
uncurry2 :: (a -> b -> c) -> (a, b) -> c
|
||||
uncurry2 f (x, y) = f x y
|
||||
|
||||
curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d
|
||||
curry3 f x y z = f (x, y, z)
|
||||
|
||||
uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
|
||||
uncurry3 f (x, y, z) = f x y z
|
||||
|
||||
curry4 :: ((a, b, c, d) -> e) -> a -> b -> c -> d -> e
|
||||
curry4 f w x y z = f (w, x, y, z)
|
||||
|
||||
uncurry4 :: (a -> b -> c -> d -> e) -> (a, b, c, d) -> e
|
||||
uncurry4 f (w, x, y, z) = f w x y z
|
||||
|
||||
-- lists
|
||||
|
||||
splitAtElement :: Eq a => a -> [a] -> [[a]]
|
||||
|
Loading…
Reference in New Issue
Block a user