haskell-graphql / graphql-api

Write type-safe GraphQL services in Haskell
BSD 3-Clause "New" or "Revised" License
406 stars 35 forks source link

Transforming Handler #185

Open dmjio opened 6 years ago

dmjio commented 6 years ago

Is there currently a way (and if not, a plan) for supporting any other Monad besides Handler when resolving queries / mutations? servant accomplishes through a monad morphism. I'd really like to be able to further transform Handler. If this is not supported, and there is no current architecture for doing so, I wouldn't mind giving this a shot. Do advise. cc @jml

jml commented 6 years ago

All through Handler as of today. What other monad do you want to use? On Fri, 1 Jun 2018 at 01:49, David Johnson notifications@github.com wrote:

Is there currently a way (and if not, a plan) for supporting any other Monad besides Handler when resolving queries / mutations? servant accomplishes through a monad morphism. I'd really like to be able to further transform Handler. If this is not supported, and there is no current architecture for doing so, I wouldn't mind giving this a shot. Do advise.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/haskell-graphql/graphql-api/issues/185, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHq6us7NjYJU5kXN_A4RYkjItNhX3Ioks5t4I-PgaJpZM4UV8Am .

dmjio commented 6 years ago

I want to be able to use any monad. All I should need to provide is a function that can get back to Handler from my custom monad.

Sent from my iPhone

On Jun 1, 2018, at 1:34 AM, Jonathan Lange notifications@github.com wrote:

All through Handler as of today. What other monad do you want to use? On Fri, 1 Jun 2018 at 01:49, David Johnson notifications@github.com wrote:

Is there currently a way (and if not, a plan) for supporting any other Monad besides Handler when resolving queries / mutations? servant accomplishes through a monad morphism. I'd really like to be able to further transform Handler. If this is not supported, and there is no current architecture for doing so, I wouldn't mind giving this a shot. Do advise.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/haskell-graphql/graphql-api/issues/185, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHq6us7NjYJU5kXN_A4RYkjItNhX3Ioks5t4I-PgaJpZM4UV8Am .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

jml commented 6 years ago

I'm not rejecting your use case—it's a good point. I'm just curious as to the specific motivation.

By all means, do give this a shot.

dmjio commented 6 years ago

For example, ReaderT r IO would be a monad I’d like to use. Would it be as simple as making an instance for HasResolver?

jml commented 6 years ago

I genuinely don’t know. I’d look at what servant does and try to copy from that. On Fri, 1 Jun 2018 at 10:37, David Johnson notifications@github.com wrote:

For example, ReaderT r IO would be a monad I’d like to use. Would it be as simple as making an instance for HasResolver?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/haskell-graphql/graphql-api/issues/185#issuecomment-393828535, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHq6uAgkThzowtmUGLM61gSFOkGszhxks5t4QtegaJpZM4UV8Am .