Open jorisdral opened 5 hours ago
Is it even possible to do this if m
is mentioned in the MonadThrow
class head? Do we have to define helper functions that reorder the type arguments?
That's a good question! A helper function would do it. I am also not sure if moving the constraint from the class head to the function type would do anything.
Control.Exception.Try
andControl.Monad.Class.MonadThrow.try
have a different order of type arguments. I think we should follow whatControl.Exception.Try
does, because it makes it easier to specify the exception type we want to catch, e.g.try @SomeException
.Control.Monad.Class.MonadThrow.try
wants you to specify the monad first, so you end up having to writetry @m @SomeException
instead.https://github.com/input-output-hk/io-sim/blob/13fa0cf4b1287d4a03f65c8e090a1a5bcd948098/io-classes/src/Control/Monad/Class/MonadThrow.hs#L90
There might be other functions in
MonadThrow
and co that could benefit from explicitly ordering type arguments, but changingtry
should be a good starting point.