Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Add an error parameter to the ThrowAll typeclass #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AJChapman
Copy link

This is so that an application can use its own custom error type and still call throwAll.

This is so that an application can use its own custom error type and still call `throwAll`.
@domenkozar
Copy link
Collaborator

Could you define type ThrowAll = ThrowAll' ServerError to avoid a major breaking change?

@AJChapman
Copy link
Author

@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?

@domenkozar
Copy link
Collaborator

Maybe that's a good candidate for servant then: haskell-servant/servant#765

@phadej @alpmestan what do you think?

@phadej
Copy link
Contributor

phadej commented Aug 12, 2019

@alpmestan
Copy link
Contributor

servant-generate was inspired by -auth's venerable ThrowAll :-)

And I think it should cover this use case, indeed.

@domenkozar
Copy link
Collaborator

See #168

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants