Created
October 5, 2017 00:19
-
-
Save vaibhavsagar/688dc28349d3eb85cd51449decd75722 to your computer and use it in GitHub Desktop.
Fun with (.).(.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Owl where | |
import System.FilePath ((</>)) | |
fromMaybe :: a -> Maybe a -> a | |
fromMaybe a m = case m of | |
Nothing -> a | |
Just b -> b | |
prependPath :: FilePath -> FilePath -> FilePath | |
prependPath dir base = dir </> base | |
makePath'', makePath', makePath :: FilePath -> FilePath -> Maybe FilePath -> FilePath | |
makePath'' dir def maybeValue = prependPath dir $ fromMaybe def maybeValue | |
makePath' dir def = prependPath dir . fromMaybe def | |
(.:) :: (b -> c) -> (d -> a -> b) -> d -> a -> c | |
(.:) = (.) . (.) | |
makePath base = prependPath base .: fromMaybe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment