summaryrefslogtreecommitdiff
path: root/Haskell-book/07/src/GrabBag.purs
blob: 2967002ffda85a27026150fc4a6c52fe31dad35d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module GrabBags where

import Data.Int (odd)
import Prelude

-- 3 a)
addOneIfOdd :: Int -> Int
addOneIfOdd n = case odd n of
    true -> f n
    false -> n
    where f = \k -> k + 1

addFive :: (Int -> (Int -> Int))
addFive = \x -> \y -> (if x > y then y else x) + 5