Add an error parameter to the ThrowAll typeclass
This is so that an application can use its own custom error type and still call throwAll.
Could you define type ThrowAll = ThrowAll' ServerError to avoid a major breaking change?
@domenkozar I have tried your suggestion but I can't get it to work. For example, with the type alias we still get errors like this:
src/Servant/Auth/Server.hs:128:5-22: error:
• The type constructor ‘ThrowAll’ is not the parent of the identifier ‘throwAll’.
Identifiers can only be exported with their parent type constructor.
Parent: ThrowAll'
• In the export: ThrowAll(throwAll)
|
128 | , ThrowAll(throwAll)
| ^^^^^^^^^^^^^^^^^^
I think to avoid a breaking change I would have to create typeclass ThrowAll', with function throwAll', and leave the existing ThrowAll typeclass, function throwAll, and instances all in place. Should I do it that way?
Maybe that's a good candidate for servant then: https://github.com/haskell-servant/servant/issues/765
@phadej @alpmestan what do you think?
I wonder if that's what https://hackage.haskell.org/package/servant-generate-0.1/docs/Servant-Server-Generate.html does.
servant-generate was inspired by -auth's venerable ThrowAll :-)
And I think it should cover this use case, indeed.
See #168