Skip to content

Instantly share code, notes, and snippets.

@yasuabe
Created May 12, 2017 13:00
Show Gist options
  • Save yasuabe/9068dbdfa327070ea3dc6b6ffc1cc193 to your computer and use it in GitHub Desktop.
Save yasuabe/9068dbdfa327070ea3dc6b6ffc1cc193 to your computer and use it in GitHub Desktop.
haskell implementation of simpath: Common
module Simpath.Common where
justIf :: Bool -> a -> Maybe a
justIf b a = if b then Just a else Nothing
mapOrElse :: (a -> b) -> b -> Maybe a -> b
mapOrElse f b ma = case ma of { Just a -> f a; _ -> b }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment