Skip to content

Instantly share code, notes, and snippets.

@raindev
Created April 24, 2015 12:56
Show Gist options
  • Save raindev/62dbdf643d38b474e287 to your computer and use it in GitHub Desktop.
Save raindev/62dbdf643d38b474e287 to your computer and use it in GitHub Desktop.
Haskell ternary-operator-like function with custom predicate
ifp :: (a -> Bool) -> a -> a -> a
ifp p x y
| p x = x
| otherwise = y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment