Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for aeson 2.2 #170

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions arbtt.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ executable arbtt-capture
base >= 4.7 && < 5,
filepath, directory, transformers, utf8-string, strict,
containers >= 0.5 && < 0.7,
aeson >= 0.10 && < 2.2,
aeson >= 0.10 && < 2.3,
attoparsec-aeson < 2.3,
binary >= 0.6.4,
bytestring, deepseq,
time >= 1.5, tz
Expand Down Expand Up @@ -96,7 +97,8 @@ executable arbtt-stats
binary >= 0.6.4,
deepseq, bytestring, utf8-string, strict,
transformers, directory, filepath,
aeson >= 0.10 && < 2.2,
aeson >= 0.10 && < 2.3,
attoparsec-aeson < 2.3,
array == 0.4.* || == 0.5.*,
terminal-progress-bar >= 0.4 && < 0.5,
bytestring-progress,
Expand Down Expand Up @@ -137,7 +139,8 @@ executable arbtt-dump
base >= 4.7 && < 5,
parsec == 3.*,
containers >= 0.5 && < 0.7,
aeson >= 0.10 && < 2.2,
aeson >= 0.10 && < 2.3,
attoparsec-aeson < 2.3,
binary >= 0.6.4,
deepseq, bytestring, utf8-string, strict,
transformers, directory, filepath,
Expand Down Expand Up @@ -172,7 +175,8 @@ executable arbtt-import
parsec == 3.*,
containers >= 0.5 && < 0.7,
binary >= 0.6.4,
aeson >= 0.10 && < 2.2,
aeson >= 0.10 && < 2.3,
attoparsec-aeson < 2.3,
conduit >= 1.2 && < 1.4,
exceptions >= 0.8,
attoparsec >= 0.13,
Expand Down
5 changes: 5 additions & 0 deletions src/import-main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
import Control.Applicative
import Data.Conduit.Attoparsec
import Data.Conduit
#if MIN_VERSION_aeson(2,2,0)
import Data.Aeson (parseJSON)
import Data.Aeson.Parser (json)
#else
import Data.Aeson (parseJSON, json)
#endif
import Data.Aeson.Types (parseEither)
import Data.Binary.StringRef
import Data.Attoparsec.ByteString.Char8 (skipSpace, option)
Expand Down Expand Up @@ -82,14 +87,14 @@
"output format, one of Show (default) or JSON "
]

parseConduit :: DumpFormat -> Conduit BS.ByteString IO [TimeLogEntry CaptureData]

Check warning on line 90 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of type constructor or class ‘Conduit’

Check warning on line 90 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of type constructor or class ‘Conduit’

Check warning on line 90 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of type constructor or class ‘Conduit’

Check warning on line 90 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of type constructor or class ‘Conduit’

Check warning on line 90 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.2.1, ubuntu-latest)

In the use of type constructor or class ‘Conduit’
parseConduit DFHuman = error "Cannot read back human format"
parseConduit DFShow = C.lines =$= C.map ( (:[]) . read . BS.unpack)

Check warning on line 92 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 92 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 92 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 92 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 92 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.2.1, ubuntu-latest)

In the use of ‘=$=’
parseConduit DFJSON =
conduitParser (ignoreWhiteSpace json)
=$= C.map snd

Check warning on line 95 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 95 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 95 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 95 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 95 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.2.1, ubuntu-latest)

In the use of ‘=$=’
=$= C.catMaybes

Check warning on line 96 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 96 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 96 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 96 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 96 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.2.1, ubuntu-latest)

In the use of ‘=$=’
=$= tlConduit

Check warning on line 97 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 97 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 97 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 97 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 97 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.2.1, ubuntu-latest)

In the use of ‘=$=’
where
tlConduit = C.mapM $ \ v ->
case parseEither oneOrMany v of
Expand All @@ -104,8 +109,8 @@
ignoreWhiteSpace p = skipSpace *> option Nothing (Just <$> p)

binaryConduit :: ListOfStringable a =>
Conduit [(TimeLogEntry a, Maybe a)] IO (Flush BS.ByteString)

Check warning on line 112 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of type constructor or class ‘Conduit’

Check warning on line 112 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of type constructor or class ‘Conduit’

Check warning on line 112 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of type constructor or class ‘Conduit’

Check warning on line 112 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of type constructor or class ‘Conduit’

Check warning on line 112 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.2.1, ubuntu-latest)

In the use of type constructor or class ‘Conduit’
binaryConduit = C.map (map go) =$= C.concatMap chunk

Check warning on line 113 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 113 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 113 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 113 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 113 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.2.1, ubuntu-latest)

In the use of ‘=$=’
where
go (x,prev) = BSL.toStrict $ ls_encode strs x
where strs = maybe [] listOfStrings prev
Expand Down Expand Up @@ -134,9 +139,9 @@

h <- openBinaryFile (optLogFile flags) AppendMode
runConduit $ C.sourceHandle stdin
=$= parseConduit (optFormat flags)

Check warning on line 142 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 142 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 142 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 142 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 142 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.2.1, ubuntu-latest)

In the use of ‘=$=’
=$= stutterList

Check warning on line 143 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 143 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 143 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 143 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 143 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.2.1, ubuntu-latest)

In the use of ‘=$=’
=$= binaryConduit

Check warning on line 144 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.10.7, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 144 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.6.5, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 144 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (9.0.1, ubuntu-latest)

In the use of ‘=$=’

Check warning on line 144 in src/import-main.hs

View workflow job for this annotation

GitHub Actions / test (8.8.4, ubuntu-latest)

In the use of ‘=$=’
=$= C.sinkHandleFlush h
hClose h

Expand Down
Loading