[input-output-hk/cardano-sl] [CBR-243] improve wallet worker start-up and exception handling (#3330)

parsonsmatt commented on this pull request.

> @@ -55,13 +56,11 @@ data WalletWorkerState b = WalletWorkerState

makeLenses »WalletWorkerState

— A helper function for lifting a `WalletActionInterp` through a monad transformer.
-lifted :: (Monad m, MonadTrans t) => WalletActionInterp m b -> WalletActionInterp (t m) b
-lifted i = WalletActionInterp
— { applyBlocks = lift . applyBlocks i
— , switchToFork = \n bs -> lift (switchToFork i n bs)
— , emit = lift . emit i
— }
+instance MFunctor WalletActionInterp where
+ hoist nat i = WalletActionInterp
+ { applyBlocks = fmap nat (applyBlocks i)
+ , switchToFork = fmap (fmap nat) (switchToFork i)
+ , emit = fmap nat (emit i) }

I’m in favor of using `mmorph` explicitly. It’s a good abstraction with a clear set of laws, and I don’t anticipate it will need to be used too much.

Добавить комментарий