Skip to content

Instantly share code, notes, and snippets.

@third774
Created April 23, 2019 04:23
Show Gist options
  • Save third774/c61b91b1115ec528017513919b9d4d5a to your computer and use it in GitHub Desktop.
Save third774/c61b91b1115ec528017513919b9d4d5a to your computer and use it in GitHub Desktop.
chk :: Eq b => (a -> b) -> a -> b -> Bool
-- All arguments are present on the left
-- chk fn a b = b == fn a
-- get rid of 'b' param on the left by partially applying (==) operator
-- chk fn a = (== fn a)
-- get rid of 'a' param on the left by composing (==) after fn
-- chk fn = (==) . fn
-- get rid of fn on the left by partially applying the (.) operator
chk = ((==) .)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment