on master help sign in
wip
commit3e30687e8b9ae73dba99cfa87846c22f5bc0ea77 authorMark Wotton <mwotton@gmail.com> dateFri 27 Nov 2020, 12:54 (6 years ago) parentbbba055
2 files changed+13−8
src/Roboservant/Direct.hs+6−6 src/Roboservant/Types/Breakdown.hs+7−2
src/Roboservant/Direct.hs+6−6
@@ -132,7 +132,7 @@ fuzz server Config{..} checker = handle (pure . Just . formatException) $ do
132132 stash = addToStash seed mempty
133133 currentRng = mkStdGen rngSeed
134134
135−
135+ print ("Initial seed", seed, stash)
136136 deadline :: UTCTime <- addUTCTime (fromInteger $ maxRuntime * 1000000) <$> getCurrentTime
137137 (stopreason, fs ) <- runStateT
138138 (untilDone (maxReps, deadline) go <* (evaluateCoverage =<< get)) FuzzState{..}
@@ -151,7 +151,7 @@ fuzz server Config{..} checker = handle (pure . Just . formatException) $ do
151151 putStrLn ""
152152 putStrLn "types in stash"
153153 DM.forWithKey_ (getStash stash) $ \k v ->
154− print (k,NEL.length $ getStashValue v)
154+ print (NEL.length $ getStashValue v)
155155 -- mapM_
156156 -- (print . second NEL.length)
157157 -- (sortOn (show . fst) $ Map.toList $ getStash stash)
@@ -231,7 +231,7 @@ fuzz server Config{..} checker = handle (pure . Just . formatException) $ do
231231 -> V.Rec (TypedF V.Identity) as
232232 -> m ()
233233 execute fuzzop func args = do
234− liftIO $ print fuzzop
234+ (liftIO . print . (fuzzop,) . stash ) =<< get
235235 st <- get
236236 let showable = unlines $ ("args":map show argTypes)
237237 <> ["fuzzop"
@@ -239,8 +239,8 @@ fuzz server Config{..} checker = handle (pure . Just . formatException) $ do
239239 -- ,"dyncall"
240240 -- ,show (dynTypeRep dyncall)
241241 ,"state"
242− ,show st]
243− liftIO $ putStrLn showable
242+ ]
243+ -- liftIO $ putStrLn showable
244244 liftIO (V.runcurry' func argVals) >>= \case
245245 -- parameterise this
246246 Left (serverError :: ServerError) ->
@@ -249,7 +249,7 @@ fuzz server Config{..} checker = handle (pure . Just . formatException) $ do
249249 _ -> do
250250 liftIO $ print ("ignoring non-500 error" , serverError)
251251 Right (dyn :: NEL.NonEmpty Dynamic) -> do
252− liftIO $ print ("storing", fmap dynTypeRep dyn)
252+ -- liftIO $ print ("storing", fmap dynTypeRep dyn)
253253 modify' (\fs@FuzzState{..} ->
254254 fs { stash = addToStash (NEL.toList dyn) stash } )
255255 where
src/Roboservant/Types/Breakdown.hs+7−2
@@ -56,6 +56,13 @@ instance (Typeable x, Generic x) => BuildFrom (Compound x) where
5656-- instance (Typeable x, Generic x) => Breakdown (Compound x) where
5757-- breakdown x = _ . Generics.from . unCompound $ x
5858
59+instance Typeable x => Breakdown (Atom x) where
60+ breakdown = pure . toDyn
61+
62+-- instance Typeable a => Breakdown (Atom a) where
63+-- breakdown = pure . toDyn . unAtom
64+
65+
5966instance Typeable x => BuildFrom (Atom x) where
6067 buildFrom = DM.lookup R.typeRep . getStash
6168
@@ -91,8 +98,6 @@ instance (Typeable x, BuildFrom x) => BuildFrom (Maybe x) where
9198deriving via (Atom ()) instance Breakdown ()
9299deriving via (Atom Int) instance Breakdown Int
93100
94−instance Typeable a => Breakdown (Atom a) where
95− breakdown = pure . toDyn . unAtom
96101
97102
98103instance (Typeable a, Breakdown a) => Breakdown [a] where