Are there any best practices/guidelines/good examples of 3rd-party api client libraries in Haskell? I know we’re a proud people and less itchy for basically-a-thin-wrapper-around-http “SDK” libraries than other communities but there are still times when it’s nice to have auth/urls/payloads abstracted away, or at least hidden somewhat.
Say you’ve got an API that has multiple root urls (sandbox/prod, free/paid, etc.) and some OAuth(ish/-inspired) auth situation, with credentials that need to be renewed periodically, etc. Would it be more ergonomic/dev-friendly to have a wholly isolated newtype Api = Api { runApi :: ReaderT ApiSpecificConfig IO (Either ApiSpecificError ApiSpecificResult) }
, or HasApiSpecificConfig
typeclasses (and optics etc)/makeApiRequest :: HasApiSpecificConfig m, MonadIO m => ApiSpecificData -> m (Either ApiSpecificError ApiSpecificResult)
? I just haven’t seen (m)any examples of this kind of thing floating around.