Skip to content

Instantly share code, notes, and snippets.

@erantapaa
Created October 21, 2015 10:10
Show Gist options
  • Save erantapaa/066b145189023edd3618 to your computer and use it in GitHub Desktop.
Save erantapaa/066b145189023edd3618 to your computer and use it in GitHub Desktop.
pipes-file example
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