I'm always glad to see videos like this.  I wish more people could have that 
much fun playing with math ;).

It wouldn't really be suitable for your application but another interesting 
generalization is to insert the 'Either' at the top level:

> data ConwayT m a
>     = Pure a
>     | ConwayT
>         { runLeftConwayT  :: m (ConwayT m a)
>         , runRightConwayT :: m (ConwayT m a)
>         } 

Using this construction, the "handedness" of the structure doesn't appear until 
you start implementing binary operations on games, so there is a unique monad 
structure instead of just a unique bind/join:

> instance Functor m => Monad (ConwayT m) where
>     return = Pure
>     Pure x >>= f  = f x
>     ConwayT l r >>= f    = ConwayT (fmap (>>= f) l) (fmap (>>= f) r)

but there are then (at least) two versions of every monoid structure.  Given 
that monoidal structures such as addition and multiplication are the main 
purpose of a calculator it's probably simpler in this case to just give up the 
'unit' as you chose to do.  On the other hand, if for some reason a monadic 
structure is the extent of one's interest then this version definitely 
simplifies that structure.

-- James

On Jul 27, 2011, at 4:31 AM, Greg Meredith wrote:

> Dear Haskellians,
> 
> A new C9 video in the series!
> 
> So, you folks already know most of this... except for maybe the 
> generalization of the Conway construction!
> 
> Best wishes,
> 
> --greg
> 
> ---------- Forwarded message ----------
> From: Charles Torre <...>
> Date: Tue, Jul 26, 2011 at 1:12 PM
> Subject: C9 video in the Monadic Design Patterns for the Web series
> To: Meredith Gregory <[email protected]>
> Cc: Brian Beckman <...>
> 
> 
> And we’re live!
> 
>  
> 
> http://channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n
> 
> C
> 
>  
> 
> From: Charles Torre 
> Sent: Tuesday, July 26, 2011 11:51 AM
> To: 'Meredith Gregory'
> Cc: Brian Beckman
> Subject: C9 video in the Monadic Design Patterns for the Web series
> 
>  
> 
> Here it ‘tis:
> 
>  
> 
> Greg Meredith, a mathematician and computer scientist, has graciously agreed 
> to do a C9 lecture series covering monadic design principles applied to web 
> development. You've met Greg before in a Whiteboard jam session with Brian 
> Beckman.
> 
> The fundamental concept here is the monad, and Greg has a novel and 
> conceptually simplified explanation of what a monad is and why it matters. 
> This is a very important and required first step in the series since the 
> whole of it is about the application of monadic composition to real world web 
> development.
> 
> In part 4, Greg primarily focuses on the idea that a monad is really an API 
> -- it's a view onto the organization of data and control structures, not 
> those structures themselves. In OO terms, it's an interface. To make this 
> point concrete Greg explores one of the simplest possible data structures 
> that supports at least two different, yet consistent interpretations of the 
> same API. The structure  used, Conway's partisan games, turned out to be 
> tailor-made for this investigation. Not only does this data structure have 
> the requisite container-like shape, it provided opportunities to see just 
> what's necessary in a container to implement the monadic interface.
> 
> Running throughout the presentation is a more general comparison of reuse 
> between an OO approach versus a more functional one. When the monadic API is 
> "mixed into" the implementing structure we get less reuse than when the 
> implementing structure is passed as a type parameter. Finally, doing the work 
> put us in a unique position to see not just how to generalize Conway's 
> construction, monadically, but the underlying pattern which allows the 
> generalization to suggest itself.
> 
> See part 1 
> See part 2
> See part 3
> 
>  
> 
> -- 
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 7329 39th Ave SW
> Seattle, WA 98136
> 
> +1 206.650.3740
> 
> http://biosimilarity.blogspot.com
> 
> 
> 
> 
> -- 
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 1219 NW 83rd St 
> Seattle, WA 98117
> 
> +1 206.650.3740
> 
> http://biosimilarity.blogspot.com
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to