Skip to content

Re-engineer Verb #841

Closed
Closed
@phadej

Description

@phadej

The idea is that

Instead of having

a :> b :> Verb c

we could have

a :> b :> Verb (c :< d)

which is transformed into something like

a -> b -> m (c, d)

Verb glues RHS and LHS together. This way we can

  • Have checked exceptions (here "date" endpoint cannot error!)

    type MyAPI = "date" :> Verb (Full Day)
            :<|> "time" :> Capture TimeZone :> Verb (ServantErr :< Full ZonedTime)
  • Get rid of {-# OVERLAPPING #-} instances, as in

    type NoContentAPI = "tick" :> Verb NoContent

    NoContent doesn't overlap Full a. Similarly we can have Stream a and
    Headers ... :< ....


The devil in the details how to fit this into Router and DelayedIO
framework we have, but I don't see why it's not possible.

The names of auxiliary class HasServer' and Full combinator are open to
bikesheding.


Comments?

Metadata

Metadata

Assignees

No one assigned

    Labels

    rfczurihac2020https://github.com/haskell-servant/servant/issues/1299

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions