on master help sign in
tiny cleanup
commitda4b0715c6f45aff5862513544ea88d2c733ef70 authorMark Wotton <mwotton@gmail.com> dateSun 27 Sep 2020, 15:20 (6 years ago) parent0be3abc
2 files changed+6−8
src/Roboservant/StateMachine.hs+3−3 src/Roboservant/Types/ReifiedApi.hs+3−5
src/Roboservant/StateMachine.hs+3−3
@@ -66,7 +66,7 @@ callEndpoint staticRoutes =
6666 options :: [(ApiOffset, [[Var (Opaque (IORef Dynamic)) Symbolic]])]
6767 options =
6868 mapMaybe
69− ( \(offset, argreps, _retType, _dynCall) -> (offset,) <$> do
69+ ( \(offset, (argreps, _retType, _dynCall)) -> (offset,) <$> do
7070 mapM fillableWith argreps
7171 )
7272 staticRoutes
@@ -82,7 +82,7 @@ callEndpoint staticRoutes =
8282 execute (Op (ApiOffset offset) args) = do
8383 fmap Opaque . liftIO $ do
8484 realArgs <- mapM (readIORef . opaque) args
85− let (_offset, _staticArgs, _ret, endpoint) = staticRoutes !! offset
85+ let (_offset, (_staticArgs, _ret, endpoint)) = staticRoutes !! offset
8686 -- now, magic happens: we apply some dynamic arguments to a dynamic
8787 -- function and hopefully something useful pops out the end.
8888 func = foldr (\arg curr -> flip dynApply arg =<< curr) (Just endpoint) realArgs
@@ -110,7 +110,7 @@ callEndpoint staticRoutes =
110110 (Op (ApiOffset offset) _args) ->
111111 s
112112 { stateRefs =
113− let (_, _, tr, _) = staticRoutes !! offset
113+ let (_, (_, tr, _)) = staticRoutes !! offset
114114 in Map.insertWith
115115 (<>)
116116 tr
src/Roboservant/Types/ReifiedApi.hs+3−5
@@ -33,7 +33,7 @@ newtype ApiOffset = ApiOffset Int
3333
3434type ReifiedEndpoint = ([TypeRep], TypeRep, Dynamic)
3535
36−type ReifiedApi = [(ApiOffset, [TypeRep], TypeRep, Dynamic)]
36+type ReifiedApi = [(ApiOffset, ReifiedEndpoint)]
3737
3838
3939class ToReifiedApi (endpoints :: [*]) where
@@ -50,12 +50,10 @@ instance
5050 ToReifiedApi (endpoint : endpoints)
5151 where
5252 toReifiedApi (endpoint `AnEndpoint` endpoints) _ =
53− withOffset (toReifiedEndpoint (toDyn (normalize endpoint)) (Proxy @endpoint))
53+ (0,) (toReifiedEndpoint (toDyn (normalize endpoint)) (Proxy @endpoint))
5454 : map
55− (\(n, x, y, z) -> (n + 1, x, y, z))
55+ (\(n, x) -> (n + 1, x))
5656 (toReifiedApi endpoints (Proxy @endpoints))
57− where
58− withOffset (x, y, z) = (0, x, y, z)
5957
6058class NormalizeFunction m where
6159 type Normal m