Compare commits
No commits in common. "6a8c937d241156ab3b6ac684c2dc5e0fd9648dde" and "bc87a6123329783a8d0d3225fd9dc6aedf94bf5c" have entirely different histories.
6a8c937d24
...
bc87a61233
2 changed files with 10 additions and 13 deletions
12
ips.cabal
12
ips.cabal
|
@ -12,7 +12,7 @@ bug-reports: https://git.rhiannon.website/rhi/ips/issues
|
||||||
|
|
||||||
source-repository head
|
source-repository head
|
||||||
type: git
|
type: git
|
||||||
location: https://git.rhiannon.website/rhi/ips.git
|
location: git://git.rhiannon.website/rhi/ips.git
|
||||||
|
|
||||||
common deps
|
common deps
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
@ -24,11 +24,11 @@ common deps
|
||||||
NamedFieldPuns,
|
NamedFieldPuns,
|
||||||
OverloadedStrings
|
OverloadedStrings
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.14.1.0 && < 4.22,
|
base ^>= 4.14.1.0,
|
||||||
bytestring >= 0.11.1.0 && < 0.13,
|
bytestring ^>= 0.11.1.0,
|
||||||
vector >= 0.12.2.0 && < 0.14,
|
vector ^>= 0.12.2.0,
|
||||||
attoparsec >= 0.13.2.5 && < 0.15,
|
attoparsec >= 0.13.2.5 && < 0.15,
|
||||||
primitive >= 0.7.1.0 && < 0.10
|
primitive ^>= 0.7.1.0
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
||||||
library
|
library
|
||||||
|
|
11
main/ips.hs
11
main/ips.hs
|
@ -2,9 +2,8 @@ module Main (main) where
|
||||||
|
|
||||||
import IPS (Bytes, makeBytes)
|
import IPS (Bytes, makeBytes)
|
||||||
import qualified IPS
|
import qualified IPS
|
||||||
import System.Environment (getArgs)
|
import System.Environment
|
||||||
import System.Exit (exitFailure)
|
import System.IO
|
||||||
import System.IO (hPutBuf, withFile, IOMode(WriteMode))
|
|
||||||
import qualified Data.ByteString as ByteString
|
import qualified Data.ByteString as ByteString
|
||||||
import qualified Data.Vector.Storable as Vector
|
import qualified Data.Vector.Storable as Vector
|
||||||
|
|
||||||
|
@ -14,11 +13,9 @@ main = do
|
||||||
case args of
|
case args of
|
||||||
[inf, ipsf, outf] -> do
|
[inf, ipsf, outf] -> do
|
||||||
buf <- readBytes inf
|
buf <- readBytes inf
|
||||||
ips <- either error id <$> IPS.parseFile ipsf
|
ips <- either error id <$> IPS.read ipsf
|
||||||
writeBytes outf $ IPS.apply ips buf
|
writeBytes outf $ IPS.apply ips buf
|
||||||
_ -> do
|
_ -> error "usage: $0 <in> <ips> <out>"
|
||||||
putStrLn "usage: ips <in> <ips> <out>"
|
|
||||||
exitFailure
|
|
||||||
|
|
||||||
readBytes :: FilePath -> IO Bytes
|
readBytes :: FilePath -> IO Bytes
|
||||||
readBytes f = makeBytes <$> ByteString.readFile f
|
readBytes f = makeBytes <$> ByteString.readFile f
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue