2

I have a basic hello world Spock app from following the tutorial, but now I want to add my own monad transformer, FooT, into the Spock transformer stack somehow.

I found this answer, but it looks like spockT isn't really used in the latest version of spock. Looks like now there is a spock function that takes a SpockCfg and a SpockM, but I don't see anything that takes an m argument where I can specify my monad transformer. Is it still possible to insert a FooT, StateT, or any other monad transformer into the spock transformer stack somehow? What am I misunderstanding? Thank you!

Jesse Shieh
  • 4,660
  • 5
  • 34
  • 49
  • Which version of Spock are you using? Looking at the [latest version](http://hackage.haskell.org/package/Spock-0.13.0.0/docs/Web-Spock.html) it seems that `SpockM` is just a type alias for `SpockCtxT`, which is a monad transformer, and the alias uses [`WebStateM`](http://hackage.haskell.org/package/Spock-0.13.0.0/docs/Web-Spock.html#t:WebStateM) inside. Perhaps adding `Statet` somewhere within this stack might work. – Petr Dec 25 '18 at 15:57
  • I'm on version 0.13.0.0. Yeah, it looks like the transformer stack they use is SpockCtxT -> WebStateT -> ResourceT -> IO, but with no apparent way to insert `m` anywhere. My best guess at the moment, is that they expect you to revert back to the `spockT` function in order to use a custom monad, but then you lose all the nice features of `spock`, `SpockCfg` and `SpockM`. – Jesse Shieh Dec 25 '18 at 17:09

0 Answers0