Interoperating with MTL - Polysemy

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Sridhar Ratnakumar

Is there documentation on how polysemy can be used with libraries using mtl? eg: MonadSnap from snap.

Sridhar Ratnakumar

Looks like Polysemy.ConstraintAbsorber is the answer ...

Sridhar Ratnakumar

Looks like Polysemy.ConstraintAbsorber is the answer ...

Sridhar Ratnakumar

(Though, really, I don't have to deal with MonadSnap, as the library consumes a function returning the monorphic Snap)

Torsten Schmits

you're doing Obelisk with Polysemy? better move it out of the way for the frontend ;)

Sridhar Ratnakumar

Yea, but just for the backend. I wouldn't dare use it in ghcjs haha

Torsten Schmits

I've looked at wrapping Snap for servant-reflex for a second but it looked cumbersome. Though since then I've succesfully embedded servant/warp, maybe it's time to get back to it

Sridhar Ratnakumar

At the moment I'm playing with wrapping the database (beam) stuff only. Working super well so far: image.png

Sridhar Ratnakumar

And I've achieved separation of concepts that @Fintan Halpenny mentioned in https://funprog.zulipchat.com/#narrow/stream/201385-Haskell/topic/Why.20not.20.60MonadDatabase.60.3F/near/196659095 with little fanfare (compared to mtl)

Torsten Schmits

yeah I did the same with Hasql

Torsten Schmits

using several layers of abstraction, DbConnection, Database, Schema, Store and StoreQuery