Skip to content

Instantly share code, notes, and snippets.

@diegoeche
Created October 2, 2011 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diegoeche/1257642 to your computer and use it in GitHub Desktop.
Save diegoeche/1257642 to your computer and use it in GitHub Desktop.
-- Using Applicative
weakTo :: Monster -> Maybe Element
weakTo m = succ <$> elemType m
-- Using functors
weakTo' :: Monster -> Maybe Element
weakTo' m = succ `fmap` elemType m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment