okapi icon indicating copy to clipboard operation
okapi copied to clipboard

Split `MonadServer m` into `MonadRequest m` and `MonadResponse m`

Open rashadg1030 opened this issue 3 years ago • 0 comments

Should look something like:

-- type MonadServer m = (MonadRequest m, MonadResponse m)

class (MonadRequest m, MonadResponse m) => MonadServer m where
  throw :: ...
  next :: ...

class Monad m => MonadRequest m where
  pathParam :: ...
  queryParam :: ...

class Monad m => MonadResponse m where
  write :: forall a. Writeable a => a -> m ()

to make Okapi functions more descriptive and to constrain their abilities accordingly. Inspired by "IO Monad Considered Harmful". Don't know if this would work.

rashadg1030 avatar Oct 17 '22 06:10 rashadg1030