Сryptocurrency development analysis

Description

The Mockable typeclass is a layer of indirection which allows code to be run in different monads without requiring changes to the monadic functions.

Mockable is apparently only executed in IO, and thus provides no benefit and a fair amount of hassle due to indirection & confusion for developers.

Remove the Mockable typeclass and associated instances.

## Linked issue

https://iohk.myjetbrains.com/youtrack/issue/CDEC-451

## Type of change
— [~] 🐞 Bug fix (non-breaking change which fixes an issue)
— [~] 🛠 New feature (non-breaking change which adds functionality)
— [~] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
— [x] 🏭 Refactoring that does not change existing functionality but does improve things like code readability, structure etc
— [~] 🔨 New or improved tests for existing code
— [~] ⛑ git-flow chore (backport, hotfix, etc)

## Developer checklist
— [x] I have read the [style guide](https://github.com/input-output-hk/cardano-sl/blob/develop/docs/style-guide.md) document, and my code follows the code style of this project.
— [x] If my code deals with exceptions, it follows the [guidelines](https://github.com/input-output-hk/cardano-sl/blob/develop/docs/exceptions.md).
— [x] I have updated any documentation accordingly, if needed. Documentation changes can be reflected in opening a PR on [cardanodocs.com](https://github.com/input-output-hk/cardanodocs.com), amending the inline [Haddock](https://www.haskell.org/haddock/) comments, any relevant README file or one of the document listed in the [docs](https://github.com/input-output-hk/cardano-sl/tree/develop/docs) directory.

## Testing checklist
— [~] I have added tests to cover my changes.
— [x] All new and existing tests passed.
^ I can see a good argument for tests to ensure the functions of `Pos.Core.Conc` are equivalent to those of `Pos.Core.Mockable.Production`. At present I have not added such tests, though.
You can view, comment on, or merge this pull request online at:

https://github.com/input-output-hk/cardano-sl/pull/3285

— Commit Summary —

* [CDEC-451] Delete «abuse» example program
* [CDEC-451] Delete dead modules
* [CDEC-451] Remove source-file imports of `Mockable`
* [CDEC-451] Remove Mockable; update test packages

— File Changes —

M auxx/Main.hs (17)
M auxx/cardano-sl-auxx.cabal (1)
M auxx/src/Command/Tx.hs (9)
M auxx/src/Mode.hs (3)
M auxx/src/Plugin.hs (6)
M block/src/Pos/Block/BListener.hs (4)
M block/src/Pos/Block/Logic/Internal.hs (4)
M block/src/Pos/Block/Lrc.hs (2)
M client/src/Pos/Client/Txp/History.hs (2)
M client/src/Pos/Client/Txp/Network.hs (2)
M core/cardano-sl-core.cabal (19)
D core/examples/abuse/Main.hs (167)
D core/examples/abuse/README.md (177)
A core/src/Pos/Core/Conc.hs (67)
M core/src/Pos/Core/JsonLog/JsonLogT.hs (32)
D core/src/Pos/Core/Mockable.hs (14)
D core/src/Pos/Core/Mockable/Channel.hs (58)
D core/src/Pos/Core/Mockable/Class.hs (37)
D core/src/Pos/Core/Mockable/Concurrent.hs (281)
D core/src/Pos/Core/Mockable/CurrentTime.hs (35)
D core/src/Pos/Core/Mockable/Instances.hs (42)
D core/src/Pos/Core/Mockable/Metrics.hs (132)
D core/src/Pos/Core/Mockable/Monad.hs (38)
D core/src/Pos/Core/Mockable/Production.hs (209)
D core/src/Pos/Core/Mockable/SharedAtomic.hs (60)
D core/src/Pos/Core/Mockable/SharedExclusive.hs (64)
M core/src/Pos/Core/Reporting/Metrics.hs (3)
M core/src/Pos/Core/Slotting/Timestamp.hs (4)
M core/src/Pos/Core/StateLock.hs (3)
M core/src/Pos/Core/Util/TimeLimit.hs (11)
M delegation/src/Pos/Delegation/Logic/Mempool.hs (3)
M delegation/src/Pos/Delegation/Logic/VAR.hs (2)
M explorer/src/Pos/Explorer/ExplorerMode.hs (7)
M explorer/src/Pos/Explorer/Socket/App.hs (2)
M explorer/src/Pos/Explorer/Web/Transform.hs (4)
M explorer/src/explorer/Main.hs (7)
M explorer/test/Test/Pos/Explorer/Web/ServerSpec.hs (2)
M generator/src/Pos/Generator/Block/Mode.hs (3)
M generator/src/Test/Pos/Block/Logic/Emulation.hs (112)
M generator/src/Test/Pos/Block/Logic/Mode.hs (6)
M infra/cardano-sl-infra.cabal (3)
M infra/src/Pos/Infra/Communication/Protocol.hs (4)
M infra/src/Pos/Infra/DHT/Workers.hs (5)
M infra/src/Pos/Infra/Discovery/Model/Class.hs (4)
D infra/src/Pos/Infra/Discovery/Model/Neighbors.hs (59)
M infra/src/Pos/Infra/Network/CLI.hs (1)
M infra/src/Pos/Infra/Slotting/Impl/Simple.hs (5)
M infra/src/Pos/Infra/Slotting/Util.hs (9)
M lib/cardano-sl.cabal (1)
M lib/src/Pos/Client/CLI/Util.hs (4)
M lib/src/Pos/Launcher/Launcher.hs (9)
M lib/src/Pos/Launcher/Mode.hs (5)
M lib/src/Pos/Launcher/Resource.hs (9)
M lib/src/Pos/Launcher/Runner.hs (5)
M lib/src/Pos/Launcher/Scenario.hs (2)
M lib/src/Pos/Listener/Delegation.hs (3)
M lib/src/Pos/Listener/Update.hs (2)
M lib/src/Pos/Network/Block/Logic.hs (2)
M lib/src/Pos/Network/Block/Retrieval.hs (2)
M lib/src/Pos/Network/Block/WorkMode.hs (2)
D lib/src/Pos/Util/Mockable.hs (60)
M lib/src/Pos/Web/Mode.hs (3)
M lib/src/Pos/Web/Server.hs (4)
M lib/src/Pos/WorkMode.hs (3)
M lib/src/Pos/WorkMode/Class.hs (2)
M lib/src/Pos/Worker/Block.hs (2)
M lib/src/Pos/Worker/Delegation.hs (5)
M lib/src/Pos/Worker/Ssc.hs (5)
D lib/test/Test/Pos/SlottingSpec.hs.unused (76)
M lrc/src/Pos/Lrc/Mode.hs (2)
D networking/src/Network/Transport/ConnectionBuffers.hs (290)
M node/Main.hs (9)
M pkgs/default.nix (6)
M ssc/src/Pos/Ssc/Toss/Trans.hs (10)
M tools/src/blockchain-analyser/Main.hs (8)
M tools/src/blockchain-analyser/Types.hs (7)
M tools/src/dbgen/Main.hs (13)
M txp/src/Pos/Txp/MemState/Class.hs (2)
M wallet-new/server/Main.hs (26)
M wallet-new/src/Cardano/Wallet/API/V1/Handlers.hs (3)
M wallet-new/src/Cardano/Wallet/API/V1/Handlers/Addresses.hs (8)
M wallet-new/src/Cardano/Wallet/API/V1/Handlers/Transactions.hs (25)
M wallet-new/src/Cardano/Wallet/API/V1/LegacyHandlers/Info.hs (3)
M wallet-new/src/Cardano/Wallet/API/V1/Migration/Monads.hs (3)
M wallet-new/src/Cardano/Wallet/Kernel/Mode.hs (19)
M wallet-new/src/Cardano/Wallet/Server.hs (5)
M wallet-new/src/Cardano/Wallet/Server/Plugins.hs (9)
M wallet/src/Pos/Wallet/Web/Methods/Misc.hs (6)
M wallet/src/Pos/Wallet/Web/Methods/Payment.hs (6)
M wallet/src/Pos/Wallet/Web/Mode.hs (4)
M wallet/src/Pos/Wallet/Web/Pending/Worker.hs (2)
M wallet/src/Pos/Wallet/Web/Server/Runner.hs (7)
M wallet/src/Pos/Wallet/Web/State/Util.hs (3)

— Patch Links —

https://github.com/input-output-hk/cardano-sl/pull/3285.patch
https://github.com/input-output-hk/cardano-sl/pull/3285.diff

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