File tree Expand file tree Collapse file tree 2 files changed +257
-209
lines changed Expand file tree Collapse file tree 2 files changed +257
-209
lines changed Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE LambdaCase #-}
2
+ {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
3
+ {-# HLINT ignore "Redundant lambda" #-}
1
4
module Main where
2
5
3
6
-- This is a comment.
4
7
main :: IO ()
5
8
main = putStrLn " Hello, World!"
6
9
7
- -- RFC: What should `argumentOrParameter` match?
10
+ -- RFC: What should "arg" match?
8
11
fst :: (a , b ) -> a
9
12
fst tup@ (x, y) = x
10
13
-- ^ ^^^^^^^^^ <- 1️⃣ the whole pattern
11
14
-- ^^^ <- 2️⃣ only the name of the whole argument, if given
12
15
-- ^^^ ^ ^ <- 3️⃣ all names in the pattern
16
+
17
+ uncurry :: (a -> b -> c ) -> (a , b ) -> c
18
+ uncurry f = \ (x, y) -> f x y
19
+ -- ^ ^^^^^^^^^^^^^^^ <- "lambda"
20
+ -- ^^^^^ <- "inside lambda"
21
+ -- ^^^^^^ <- "pattern lambda"
22
+
23
+ fromEither :: (a -> c ) -> (b -> c ) -> Either a b -> c
24
+ fromEither f g = \ case
25
+ Left x -> f x
26
+ Right y -> g y
27
+
28
+ foo = bar
29
+ where
30
+ bar = 1
You can’t perform that action at this time.
0 commit comments