Skip to content

StoreT instances don't work well with other transformers #13

Description

@jhbertra

Problem

We're recently ran into an issue (which I believe @paluh discussed with you) regarding the instances for StoreT.

Our issue was that we wanted to add StoreT to our AppM transformer stack, which already had a ReaderT with an environment type. However, because StoreT already has a MonadAsk instance for the store type, we had to manually implement some instances to get the behaviour we desired.

You can see details here, along with our workaround:

marlowe-lang/marlowe-cardano#39

Summary of the changes I've made and would like to PR:

Add new instances for StoreT:

  • MonadReader
  • MonadTell
  • MonadWriter
  • MonadState
  • MonadCont
  • MonadRec
  • MonadTrans
  • Distributive

Modify MonadAsk instance for StoreT to delegate to the base monad m instead of the wrapped ReaderT (HalogenStore a s)

  • MonadAsk - modified to delegate to base monad m with an instance of MonadAsk instead.

Add MonadStore instances for other monad transformers:

  • ContT
  • IdentityT
  • MaybeT
  • RWST
  • ReaderT
  • StateT
  • WriterT

I can PR the necessary changes to fix this issue, and have already implemented them in our fork https://github.com/input-output-hk/purescript-halogen-store

I'm not able to open a PR on this repo however, I assume that it's restricted to contributors only?

While this is a breaking change I'm proposing, the migration steps are very straigtforward. It should be a simple matter of substituting usages of ask with getStore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions