[Haskell-cafe] HSpec & Monads

Jan von Löwenstein jan.loewenstein at gmail.com
Mon Apr 3 16:06:04 UTC 2017


Hi,

I have got a typeclass (MonadResource) that represents a client side rest
resource and encapsulates http interaction with a server.

Inside a `runResource` I want to do arbitrary calls to the server.

I have a separate implementation running in `runResourceStub` that is a
fake implementation allowing for tests that don't need a real server.

I am unsure how to (best) integrate that with HSpec.

```
it "can create related backend resources" $ do
  runResourceStub $ do
    pod <- createPod "my-pod" ...
    secret <- createSecret...
    (getPod secret) `shouldBe` pod
```

That is what I would like to do. How do I do it? What else should I
consider doing?

Best
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170403/4d9cb265/attachment.html>


More information about the Haskell-Cafe mailing list