Skip to content

Instantly share code, notes, and snippets.

@manpages
Created August 22, 2015 22:24
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 manpages/03146e22ff5ada23f5be to your computer and use it in GitHub Desktop.
Save manpages/03146e22ff5ada23f5be to your computer and use it in GitHub Desktop.
Nullable is clearly at least a functor
fmapNullable :: forall a b. (a -> b) -> (Nullable a) -> (Nullable b)
fmapNullable f x = g f $ toMaybe x
where
g f Nothing = toNullable Nothing
g f (Just v) = toNullable $ Just (f v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment