Created
October 21, 2015 10:10
-
-
Save erantapaa/066b145189023edd3618 to your computer and use it in GitHub Desktop.
pipes-file example
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 Pipes | |
| import Pipes.Files | |
| import Pipes.Safe | |
| import Data.Monoid | |
| import Data.Time.Clock | |
| import System.Posix.Files.ByteString ( fileSize ) | |
| example = do | |
| let megs = 1024 * 1024 | |
| days = 86400 | |
| now <- liftIO getCurrentTime | |
| find "." ( hasStatus (\fs -> fileSize fs < (100*megs)) | |
| <> hasMode 0o644 | |
| <> lastModified_ (> addUTCTime (-(2*days)) now) | |
| ) | |
| main = runSafeT $ runEffect $ for example (liftIO . putStrLn ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment