File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,7 @@ module Test.Assert
10
10
, getRelevantLeaderSlots
11
11
) where
12
12
13
- import Control.Applicative ((<*>) )
14
- import Control.Monad (Monad (.. ))
13
+ import Control.Monad (Monad (.. ), fail )
15
14
import Control.Monad.IO.Class (MonadIO )
16
15
import Control.Monad.Trans.Reader (ReaderT )
17
16
import Control.Monad.Trans.Resource (ResourceT )
@@ -86,10 +85,11 @@ data TraceNodeIsLeader = TraceNodeIsLeader
86
85
} deriving (Eq , Show )
87
86
88
87
instance FromJSON TraceNodeIsLeader where
89
- parseJSON = Aeson. withObject " TraceNodeIsLeader" $ \ v ->
90
- TraceNodeIsLeader
91
- <$> v .: " kind"
92
- <*> v .: " slot"
88
+ parseJSON = Aeson. withObject " TraceNodeIsLeader" $ \ v -> do
89
+ k <- v .: " val" >>= (.: " kind" )
90
+ if k == " TraceNodeIsLeader"
91
+ then TraceNodeIsLeader k <$> (v .: " val" >>= (.: " slot" ))
92
+ else fail " Not the right kind"
93
93
94
94
instance FromJSON Kind where
95
95
parseJSON = Aeson. withObject " Kind" $ \ v ->
You can’t perform that action at this time.
0 commit comments