Skip to content

Commit 5e61157

Browse files
committed
take inside funk
1 parent 341358c commit 5e61157

File tree

2 files changed

+257
-209
lines changed

2 files changed

+257
-209
lines changed

queries/haskell.hs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1+
{-# LANGUAGE LambdaCase #-}
2+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
3+
{-# HLINT ignore "Redundant lambda" #-}
14
module Main where
25

36
-- This is a comment.
47
main :: IO ()
58
main = putStrLn "Hello, World!"
69

7-
-- RFC: What should `argumentOrParameter` match?
10+
-- RFC: What should "arg" match?
811
fst :: (a, b) -> a
912
fst tup@(x, y) = x
1013
-- ^^^^^^^^^^ <- 1️⃣ the whole pattern
1114
-- ^^^ <- 2️⃣ only the name of the whole argument, if given
1215
-- ^^^ ^ ^ <- 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

0 commit comments

Comments
 (0)