Created
November 24, 2013 16:58
-
-
Save danidiaz/7629418 to your computer and use it in GitHub Desktop.
concatenative obscurity
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
| import System.Directory | |
| import System.FilePath | |
| import Control.Monad.List | |
| import Control.Arrow | |
| import Control.Applicative | |
| import Control.Lens | |
| import Data.Function | |
| import Data.Monoid | |
| cleave :: (a -> b) -> (a -> c) -> (b -> c -> d) -> a -> d | |
| cleave h i f = liftA2 f h i | |
| fam = fst &&& (\(path,time) -> replaceBaseName path $ takeBaseName path ++ time) | |
| fim = fst &&& liftA2 replaceBaseName fst (liftA2 (++) (takeBaseName.fst) snd) -- ugliest | |
| fum = fst &&& uncurry (cleave replaceBaseName ((++) . takeBaseName) (.)) | |
| fem = fst &&& uncurry (liftA2 (.) replaceBaseName ((++) . takeBaseName)) | |
| fom = fst &&& uncurry (liftA2 liftA replaceBaseName ((++) . takeBaseName)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment