Skip to content

Instantly share code, notes, and snippets.

@reinh
Created September 25, 2012 18:42
Show Gist options
  • Select an option

  • Save reinh/3783635 to your computer and use it in GitHub Desktop.

Select an option

Save reinh/3783635 to your computer and use it in GitHub Desktop.
import Control.Monad
import Control.Monad.Instances
palindrome :: String -> Bool
palindrome = ap (==) reverse
palindrome "radar" --> True
@KirinDave
Copy link
Copy Markdown

The function monad is funny. Maybe it's just that I don't work with it too much, but I always find it sort of unpredictable compared to the other monads. Contrast this to, say, the Arrow definition for functions which almost always seems to make code clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment