Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of point-free style
import Control.Category ((>>>))
data Option = Option { name :: String }
-- Point-free style. Is this readable?
-- An Option matches a String if: we get the name of the Option and then prepend "--" to it, test whether that is equal
-- to the given String.
matches :: Option -> String -> Bool
matches = name >>> ("--" ++) >>> (==)
-- Example
helpOption :: Option
helpOption = Option "help"
-- Example usage
example :: Bool
example = helpOption `matches` "--help"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.