Browse Source

Corrected withFile

Conflicted with System.IO.withFile
master
Craige McWhirter 4 years ago
parent
commit
6b79d0d8f5
No known key found for this signature in database GPG Key ID: B41FA6FF04CE4B93
  1. 6
      Cat.hs

6
Cat.hs

@ -19,12 +19,12 @@ main = do
when (Unbuffered `elem` args) $ hSetBuffering stdout NoBuffering
mapM_ (cat args) files
withFile s f = putStr . unlines . f . lines =<< open s
withFile' s f = putStr . unlines . f . lines =<< open s
where
open f = if f == "-" then getContents else readFile f
cat [] f = withFile f id
cat as f = withFile f (newline . number . visible as)
cat [] f = withFile' f id
cat as f = withFile' f (newline . number . visible as)
where
number s = if Blanks `elem` as then numberSome s else ifset Number numberAll s
newline s = ifset Dollar (map (++"$")) s

Loading…
Cancel
Save