This deck is about the leap_year function shown in https://x.com/Iceland_jack/status/1802659835642528217, i.e.

leap_year :: Integral a => a -> Bool

leap_year = liftA2 (>) (gcd 80) (gcd 50)

Given an integer representing a year, the function returns a boolean indicating if that year is a leap year.

See why the Function Applicative allows the leap_year function to be defined as shown in that tweet.

Keywords: apply, bluebird, combinators, combinatory logic, fmap, fp, function applicative, functional programming, gcd, haskell, kestrel, leap year function, lifta2, map, phoenix, pure, scala, starling

August 14, 2024