Compare commits

..

No commits in common. "6a8c937d241156ab3b6ac684c2dc5e0fd9648dde" and "bc87a6123329783a8d0d3225fd9dc6aedf94bf5c" have entirely different histories.

2 changed files with 10 additions and 13 deletions

View file

@ -12,7 +12,7 @@ bug-reports: https://git.rhiannon.website/rhi/ips/issues
source-repository head
type: git
location: https://git.rhiannon.website/rhi/ips.git
location: git://git.rhiannon.website/rhi/ips.git
common deps
default-language: Haskell2010
@ -24,11 +24,11 @@ common deps
NamedFieldPuns,
OverloadedStrings
build-depends:
base >= 4.14.1.0 && < 4.22,
bytestring >= 0.11.1.0 && < 0.13,
vector >= 0.12.2.0 && < 0.14,
attoparsec >= 0.13.2.5 && < 0.15,
primitive >= 0.7.1.0 && < 0.10
base ^>= 4.14.1.0,
bytestring ^>= 0.11.1.0,
vector ^>= 0.12.2.0,
attoparsec >= 0.13.2.5 && < 0.15,
primitive ^>= 0.7.1.0
ghc-options: -Wall
library

View file

@ -2,9 +2,8 @@ module Main (main) where
import IPS (Bytes, makeBytes)
import qualified IPS
import System.Environment (getArgs)
import System.Exit (exitFailure)
import System.IO (hPutBuf, withFile, IOMode(WriteMode))
import System.Environment
import System.IO
import qualified Data.ByteString as ByteString
import qualified Data.Vector.Storable as Vector
@ -14,11 +13,9 @@ main = do
case args of
[inf, ipsf, outf] -> do
buf <- readBytes inf
ips <- either error id <$> IPS.parseFile ipsf
ips <- either error id <$> IPS.read ipsf
writeBytes outf $ IPS.apply ips buf
_ -> do
putStrLn "usage: ips <in> <ips> <out>"
exitFailure
_ -> error "usage: $0 <in> <ips> <out>"
readBytes :: FilePath -> IO Bytes
readBytes f = makeBytes <$> ByteString.readFile f