Skip to content

Commit c6693bd

Browse files
committed
Fix shake-bench to build with aeson 2.x
1 parent 1f6326e commit c6693bd

File tree

1 file changed

+6
-4
lines changed
  • shake-bench/src/Development/Benchmark

1 file changed

+6
-4
lines changed

shake-bench/src/Development/Benchmark/Rules.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ module Development.Benchmark.Rules
6767
) where
6868

6969
import Control.Applicative
70-
import Control.Lens ((^.))
70+
import Control.Lens ((^.), view, preview)
7171
import Control.Monad
7272
import qualified Control.Monad.State as S
7373
import Data.Aeson (FromJSON (..),
7474
ToJSON (..),
7575
Value (..), object,
7676
(.!=), (.:?), (.=))
77-
import Data.Aeson.Lens (_Object)
77+
import Data.Aeson.Lens (_Object, AsJSON (_JSON), _String)
7878
import Data.Char (isDigit)
7979
import Data.List (find, isInfixOf,
8080
stripPrefix,
@@ -504,8 +504,10 @@ instance FromJSON GitCommit where
504504
parseJSON o@(Object _) = do
505505
let keymap = o ^. _Object
506506
case toList keymap of
507-
[(name, String gitName)] -> pure $ GitCommit gitName (Just name) Nothing True
508-
[(name, Object props)] ->
507+
-- excuse the aeson 2.0 compatibility hack
508+
[(preview _String . toJSON -> Just name, String gitName)] ->
509+
pure $ GitCommit gitName (Just name) Nothing True
510+
[(preview _String . toJSON -> Just name, Object props)] ->
509511
GitCommit
510512
<$> props .:? "git" .!= name
511513
<*> pure (Just name)

0 commit comments

Comments
 (0)