[Haskell-cafe] Stuck on design problem

Nicolas Trangez nicolas at incubaid.com
Mon May 20 13:25:21 CEST 2013


All,

Since I'm stuck on a coding problem and can't figure out how to proceed,
I decided to call for help.

I'm unable to get some code to typecheck, so maybe I'm missing something
obvious on the implementation side, or more likely the design is
completely wrong.

Here's the idea: I have some code which uses some log of "Entry a"
values (for some polymorphic type 'a'), and provides actions which
output "Command a" values which should be interpreted by some wrapper
code, e.g. adding some new entries to the log. These actions are
implemented in a custom WriterT transformer (in this demo code, the
original is more complex) to output Commands, while the inner monad
should give access to the log entries (this could be in-memory like in
the example, or stored on disk so using IO).

You can find a trimmed-down version at
https://gist.github.com/NicolasT/4230251f4f87f110d197

This doesn't type-check, and I'm not sure how to proceed. Am I taking a
wrong approach? Do I need a different design?

Thanks,

Nicolas




More information about the Haskell-Cafe mailing list