-
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
Check if a file is empty. #212
Comments
So you can do this using a combination of import Prelude hiding (FilePath)
import Turtle
import qualified Control.Foldl.Text
isEmpty :: MonadIO io => FilePath -> io Bool
isEmpty path = fold (input path) Control.Foldl.Text.null The main reason I suggest combining these three functions is to reduce API proliferation. Otherwise I'd need to create similar utilities for other |
Very useful trick, thanks. isFileEmpty :: MonadIO io => FilePath -> io Bool
isFileEmpty path =
fold (lineToText <$> input path) Control.Foldl.Text.null |
Actually, there may be a simpler solution, which is to use |
|
isEmpty :: FilePath -> Bool
Replacing "[ -s diff.txt ]" in bash.
The text was updated successfully, but these errors were encountered: