Skip to content

Commit 5615e1d

Browse files
committed
New curry and uncurry functions.
1 parent 470b0a0 commit 5615e1d

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

hw-prelude.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,6 @@ library
107107
HaskellWorks.Stack
108108
HaskellWorks.String
109109
HaskellWorks.ToText
110+
HaskellWorks.Tuple
110111
HaskellWorks.Unsafe
111112
hs-source-dirs: src

src/HaskellWorks/Tuple.hs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
module HaskellWorks.Tuple
2+
( uncurry3,
3+
uncurry4,
4+
uncurry5,
5+
uncurry6,
6+
uncurry7,
7+
uncurry8,
8+
uncurry9,
9+
curry3,
10+
curry4,
11+
curry5,
12+
curry6,
13+
curry7,
14+
curry8,
15+
curry9
16+
) where
17+
18+
uncurry3 :: (a -> b -> c -> z) -> (a, b, c) -> z
19+
uncurry3 fun (a, b, c) = fun a b c
20+
21+
uncurry4 :: (a -> b -> c -> d -> z) -> (a, b, c, d) -> z
22+
uncurry4 fun (a, b, c, d) = fun a b c d
23+
24+
uncurry5 :: (a -> b -> c -> d -> e -> z) -> (a, b, c, d, e) -> z
25+
uncurry5 fun (a, b, c, d, e) = fun a b c d e
26+
27+
uncurry6 :: (a -> b -> c -> d -> e -> f -> z) -> (a, b, c, d, e, f) -> z
28+
uncurry6 fun (a, b, c, d, e, f) = fun a b c d e f
29+
30+
uncurry7 :: (a -> b -> c -> d -> e -> f -> g -> z) -> (a, b, c, d, e, f, g) -> z
31+
uncurry7 fun (a, b, c, d, e, f, g) = fun a b c d e f g
32+
33+
uncurry8 :: (a -> b -> c -> d -> e -> f -> g -> h -> z) -> (a, b, c, d, e, f, g, h) -> z
34+
uncurry8 fun (a, b, c, d, e, f, g, h) = fun a b c d e f g h
35+
36+
uncurry9 :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> z) -> (a, b, c, d, e, f, g, h, i) -> z
37+
uncurry9 fun (a, b, c, d, e, f, g, h, i) = fun a b c d e f g h i
38+
39+
curry3 :: ((a, b, c) -> z) -> a -> b -> c -> z
40+
curry3 fun a b c = fun (a, b, c)
41+
42+
curry4 :: ((a, b, c, d) -> z) -> a -> b -> c -> d -> z
43+
curry4 fun a b c d = fun (a, b, c, d)
44+
45+
curry5 :: ((a, b, c, d, e) -> z) -> a -> b -> c -> d -> e -> z
46+
curry5 fun a b c d e = fun (a, b, c, d, e)
47+
48+
curry6 :: ((a, b, c, d, e, f) -> z) -> a -> b -> c -> d -> e -> f -> z
49+
curry6 fun a b c d e f = fun (a, b, c, d, e, f)
50+
51+
curry7 :: ((a, b, c, d, e, f, g) -> z) -> a -> b -> c -> d -> e -> f -> g -> z
52+
curry7 fun a b c d e f g = fun (a, b, c, d, e, f, g)
53+
54+
curry8 :: ((a, b, c, d, e, f, g, h) -> z) -> a -> b -> c -> d -> e -> f -> g -> h -> z
55+
curry8 fun a b c d e f g h = fun (a, b, c, d, e, f, g, h)
56+
57+
curry9 :: ((a, b, c, d, e, f, g, h, i) -> z) -> a -> b -> c -> d -> e -> f -> g -> h -> i -> z
58+
curry9 fun a b c d e f g h i = fun (a, b, c, d, e, f, g, h, i)

0 commit comments

Comments
 (0)