-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lsdepth, findtree, cmin, and cmax #300
Conversation
As discussed in Gabriella439#298
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just one minor style suggestion
I'm also not that concerned if cmin
and cmax
have to be in IO
, because in the worst case a user can do:
example = do
file <- findtree somePattern (ls ".")
True <- cmin someTIme file
return file
src/Turtle/Prelude.hs
Outdated
timestamp | ||
-} | ||
cmin :: MonadIO io => UTCTime -> FilePath -> io Bool | ||
cmin t file = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor stylistic suggestion: I'd suggest using a non-pointfree function:
cmin t file = adapt <$> lstat file
where
adapt x = posixSecondsToUTCTime (modificationTime x) > t
src/Turtle/Prelude.hs
Outdated
-} | ||
cmax :: MonadIO io => UTCTime -> FilePath -> io Bool | ||
cmax t file = | ||
adapt <$> lstat file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like Travis is failing on older versions of GHC due to Functor
not being a super-class of MonadIO
. You can fix that by using liftM
or do
notation
Hopefully this is fixed now, the build failed due to the hackage outage. |
Yep, that fixed it! Thanks for doing this :) |
As discussed in #298
Only issue here is that
cmin
andcmax
need to be done in aMonadIO
, so as far as I can tell it can't be used withmfilter
with them directly.Code review would be appreciated, I'm still pretty new to haskell.