[Haskell-cafe] Simple design question using Wai

Arnaud Bailly arnaud.oqube at gmail.com
Mon Oct 10 06:30:52 CEST 2011


Hi Antoine,
Thanks for your interest.

On Sun, Oct 9, 2011 at 11:57 PM, Antoine Latter <aslatter at gmail.com> wrote:

>
> > interpret :: (CommandIO io, Map t) => Commands t io CommandResult
> >
>
> What is the 'Commands' type? What is the 'Map' class?
>
>
More details here :
https://github.com/abailly/crete1941/blob/master/CommandsInterpreter.hs


> This doesn't work because the API you want to provide makes it
> possible to do wrong.
>
> Your class might be able to fit into WAI if each back-end provided a
> single function:
>
> > execute :: (Command -> io CommandResult) -> io ()
>
> This should make sense for console, Handle-based and HTTP.
>
> Am I on the right track?
>

Yes, sure. I actually think I over-engineered the whole thing and inverting
the dependency might simplify a lot of things. The signature you provide is
exactly what I was thinking about after posting my mail : simply a
game-features focused request/response conversation wrapped by whatever I/O
is needed.

Arnaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111010/79c6e415/attachment.htm>


More information about the Haskell-Cafe mailing list