[Haskell-beginners] Design of Webmachine in Haskell

Michael Snoyman michael at snoyman.com
Mon Apr 16 17:36:11 CEST 2012


On Mon, Apr 16, 2012 at 6:05 PM, Petar Radosevic <petar at wunki.org> wrote:
> Hi Michael,
>
> Michael Snoyman <michael at snoyman.com> writes:
>
>> When I was at QCon, I heard a talk from Steve Vinoski on Webmachine,
>> and I was surprised to hear how close webmachine was to Haskell
>> already, The concept is basically sticking a state monad on top of
>> WAI. My guess is you would want to use a record type for a Resource,
>> not a typeclass, to make it easier to swap out behaviors. But
>> honestly, I haven't given this any thought since I saw the
>> presentation 6 months ago.
>
> Thanks for your insight, I didn't even consider using record types for a
> resource. Will also read up upon state monads. I believe that Webmachine
> passes a dictionary to every function in the HTTP graph[1]. Do you see
> the state monad having this purpose?
>
> [1]: https://bitbucket.org/justin/webmachine/wiki/BigHTTPGraph
> --
> Petar Radosevic | @wunki

IIRC, each function is passed a dictionary and returns a new
dictionary. That's the very essence of a state monad, which is why it
could be such a perfect fit here. Of course, I may *not* be
remembering correctly.

Michael



More information about the Beginners mailing list