Compare commits
3 commits
bc87a61233
...
6a8c937d24
Author | SHA1 | Date | |
---|---|---|---|
6a8c937d24 | |||
6756c1f186 | |||
9e9788f88b |
2 changed files with 13 additions and 10 deletions
10
ips.cabal
10
ips.cabal
|
@ -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
|
||||
|
|
11
main/ips.hs
11
main/ips.hs
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue