Make `IntegrationalScenarioM` a newtype
Clarification and motivation
Because IntegrationalScenarioM
is a type alias, sometimes its definition details leak into GHC error messages and makes them much harder to read.
type IntegrationalScenarioM = StateT InternalState (Except ScenarioError)
Here's an abridged example of an error I encountered while working on morley-nettest:
repro :: forall m a. m ~ StateT Int IntegrationalScenarioM => m a -> m ()
repro ops = do
err <- expectError ops
pure ()
• Couldn't match type ‘ExceptT ScenarioError Identity’
with ‘StateT InternalState (Except ScenarioError)’
Expected type: m ExecutorError
Actual type: IntegrationalScenarioM ExecutorError
This could be improved by making it a newtype instead. Here's what the example above would look like instead:
• Couldn't match type ‘IntegrationalScenarioM’
with ‘StateT Int IntegrationalScenarioM’
Expected type: m ExecutorError
Actual type: IntegrationalScenarioM ExecutorError
Acceptance criteria
IntegrationalScenarioM
is a newtype.