Skip to content

Instantly share code, notes, and snippets.

@vaibhavsagar

vaibhavsagar/Owl.hs

Created Oct 5, 2017
Embed
What would you like to do?
Fun with (.).(.)
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