Compare commits

..

3 commits

Author SHA1 Message Date
6a8c937d24 dependency bumps 2025-04-04 23:46:19 +02:00
6756c1f186 make error slightly nicer 2025-04-04 23:46:10 +02:00
9e9788f88b haha what 2025-04-04 23:45:59 +02:00
2 changed files with 13 additions and 10 deletions

View file

@ -12,7 +12,7 @@ bug-reports: https://git.rhiannon.website/rhi/ips/issues
source-repository head
type: git
location: git://git.rhiannon.website/rhi/ips.git
location: https://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,
bytestring ^>= 0.11.1.0,
vector ^>= 0.12.2.0,
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
primitive >= 0.7.1.0 && < 0.10
ghc-options: -Wall
library

View file

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