Tech Off Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Monadic Network-Infrastructure

Back to Forum: Tech Off
  • User profile image
    exoteric

    Anyone considered writing network protocol implementations via monads?

     

    I've implemented most of a simple POP3 client in a fairly modular fashion with mostly immutable datatypes, except for Pop3Session, which contains effectful things like a TcpClient and a Stream. So the next thoughts that are occurring to me are:

    • Layer a friendly, higher-level API on top of it, with mail header/metadata parsing (System.Net.Mail.MailMessage)
    • State machine implementation for transition design; there's already some modularity but I remember there's a state machine pattern in the Object-Oriented Software Construction (OOSC) book which is a principled way to handle state and transitions
    • Asynchronicity? Not using it, can be introduced in higher-level, doing it at "low-level" may not be pretty; Rx can be used here as well
    • Monads; using monads to allow fallible requests to be strung together, not sure how yet

    I wonder how .NET BCL would look like if it was strongly principled around the use of monads everywhere (LINQ is used more and more but mostly for collections.)

     

    Current primitives (with a hint of taxomania)

    • Pop3Session { Open, User, Pass, List (int? -> Pop3ListResponse), ..., Quit }
    • Pop3State { Authorization, Transaction, Update }
    • Pop3Message { Label, ... }
    • Pop3Request : Pop3Message
    • Pop3Response : Pop3Message
    • Pop3ListRequest : Pop3Request (special argument)
    • Pop3ListResponse : Pop3Response (special result)

    There's a lot of design considerations to make...

     

    Where's the Functional [BCL] Design Guidelines? Smiley

  • User profile image
    Charles

    Yes. He will be starting a lecture series on monadic web programming in a few weeks. You've met him before on 9. Greg Meredith Wink

    C

  • User profile image
    exoteric

    Charles said:

    Yes. He will be starting a lecture series on monadic web programming in a few weeks. You've met him before on 9. Greg Meredith Wink

    C

    Oh that guy! - He operates on another level of consciousness. That sounds awesome Charles, especially if you're not joking! Big Smile

  • User profile image
    Charles

    exoteric said:
    Charles said:
    *snip*

    Oh that guy! - He operates on another level of consciousness. That sounds awesome Charles, especially if you're not joking! Big Smile

    Not joking at all. Just set up the first lecture filming, actually.

    C

  • User profile image
    staceyw

    Charles said:
    exoteric said:
    *snip*

    Not joking at all. Just set up the first lecture filming, actually.

    C

    Wondering if Greg Meredith and Jonathan Edwards may be on to the same thing with trees and distributed trees from different directions?.

    http://channel9.msdn.com/shows/Going+Deep/E2E-Whiteboard-Jam-Session-with-Brian-Beckman-Greg-Meredith-Monads-and-Coordinate-Systems/
    http://channel9.msdn.com/posts/Charles/Jonathan-Edwards-Programming-Futures-and-Declarative-Objects/

    Greg has mentioned something for a second that his lamda calculus could address any node in a tree even if all nodes was not local.  That would seem to hint at a solution to distributed data trees across the web. And if it works remote, it works local, so would seem to be a unification model.   Curious to see the many problem spaces that could help with (i.e. distributed cache, transactions, minimal data copy, etc).  Seems as if monads and functional have really started to crack some big problems for the industry and have some synergistic effects.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.