monadic Wiki Rss Feedhttp://monadic.codeplex.com/monadic Wiki Rss DescriptionUpdated Wiki: Homehttp://monadic.codeplex.com/wikipage?version=6<div class="wikidoc"><h1>Monadic</h1>
Monadic creates monad types for C# in a C# specific manner.<br /><br />This is my own research project to express a few ideas I've been having. I have decided to let it take me where it will and much what is put it in here may not seem practical. If you would like to contribute to this exploration, send me an email... or blog about it!<br /><br />The List monad is well represented with the extension methods on IEnumerable<T> in LINQ to Objects. I have found that others usually create classes to represent the Bind and Return interface used by monads, but I feel the best way to achieve the functionality of monads in C# is to do it the C# way: with extension methods on existing types. The initial checkin provides the Identity and Maybe monads using extension methods on object.<br />
<h2>IEEE ICCSIT 2010 Visitors</h2>
The presentation is <a href="http://www.kodefuguru.com/post/2010/07/10/Monadic-Comprehensions-Presentation-at-IEEE-ICCSIT-2010.aspx" class="externalLink">posted on my blog<span class="externalLinkIcon"></span></a>.<br />Learn more about <a href="http://msdn.microsoft.com/en-us/library/bb397676.aspx" class="externalLink">query expressions<span class="externalLinkIcon"></span></a>.<br /><br />If you're from Chengdu, visit the <a href="http://www.cnblogs.com/team/chengdu/" class="externalLink">local .NET user group<span class="externalLinkIcon"></span></a>.<br />If you're from elsewhere in the Asia-Pacific area, visit the <a href="http://apac.ineta.org" class="externalLink">INETA website<span class="externalLinkIcon"></span></a> to find a local .NET user group.<br />
<h2>Monadic - LINQ to Object</h2>
<h3>Identity</h3>
var result = from x in 7<br /> select x;<br /><br /> Assert.AreEqual(7, result);<br />
<h3>Maybe</h3>
var result = from x in 0<br /> where x != 0<br /> select x;<br /><br /> Assert.AreEqual(null, result);<br /><br /> Assert.AreEqual(0, result ?? 0);<br />
<h2>Functive - LINQ to Funcs</h2>
Functive provides a way to combine functions together using linq query expressions.<br /><br />Func<int, int> square = x => x * x;<br /> <br />var hypoteneuse = from h in square<br /> from w in square<br /> select Math.Sqrt(h + w); <br /> <br />Assert.AreEqual(5, hypoteneuse(3, 4));<br /><br /></div><div class="ClearBoth"></div>KodefuGuruSat, 10 Jul 2010 07:16:52 GMTUpdated Wiki: Home 20100710071652AUpdated Wiki: Homehttp://monadic.codeplex.com/wikipage?version=5<div class="wikidoc"><h1>Monadic</h1>
Monadic creates monad types for C# in a C# specific manner.<br /><br />This is my own research project to express a few ideas I've been having. I have decided to let it take me where it will and much what is put it in here may not seem practical. If you would like to contribute to this exploration, send me an email... or blog about it!<br /><br />The List monad is well represented with the extension methods on IEnumerable<T> in LINQ to Objects. I have found that others usually create classes to represent the Bind and Return interface used by monads, but I feel the best way to achieve the functionality of monads in C# is to do it the C# way: with extension methods on existing types. The initial checkin provides the Identity and Maybe monads using extension methods on object.<br />
<h2>Monadic - LINQ to Object</h2>
<h3>Identity</h3>
var result = from x in 7<br /> select x;<br /><br /> Assert.AreEqual(7, result);<br />
<h3>Maybe</h3>
var result = from x in 0<br /> where x != 0<br /> select x;<br /><br /> Assert.AreEqual(null, result);<br /><br /> Assert.AreEqual(0, result ?? 0);<br />
<h2>Functive - LINQ to Funcs</h2>
Functive provides a way to combine functions together using linq query expressions.<br /><br />Func<int, int> square = x => x * x;<br /> <br />var hypoteneuse = from h in square<br /> from w in square<br /> select Math.Sqrt(h + w); <br /> <br />Assert.AreEqual(5, hypoteneuse(3, 4));<br /><br /></div><div class="ClearBoth"></div>KodefuGuruWed, 23 Jun 2010 14:04:43 GMTUpdated Wiki: Home 20100623020443PUpdated Wiki: Homehttp://monadic.codeplex.com/wikipage?version=4<div class="wikidoc"><b>Project Description</b><br />Monadic creates monad types for C# in a C# specific manner.<br /><br />This is my own research project to express a few ideas I've been having. I have decided to let it take me where it will and much what is put it in here may not seem practical. If you would like to contribute to this exploration, send me an email... or blog about it!<br /><br />The List monad is well represented with the extension methods on IEnumerable<T> in LINQ to Objects. I have found that others usually create classes to represent the Bind and Return interface used by monads, but I feel the best way to achieve the functionality of monads in C# is to do it the C# way: with extension methods on existing types. The initial checkin provides the Identity and Maybe monads using extension methods on object.<br />
<h3>Identity</h3>
var result = from x in 7<br /> select x;<br /><br /> Assert.AreEqual(7, result);<br />
<h3>Maybe</h3>
var result = from x in 0<br /> where x != 0<br /> select x;<br /><br /> Assert.AreEqual(null, result);<br /><br /> Assert.AreEqual(0, result ?? 0);<br />
<h2>Functive</h2>
Functive provides a way to combine functions together using linq query expressions.<br /><br />Func<int, int> square = x => x * x;<br /> <br />var hypoteneuse = from h in square<br /> from w in square<br /> select Math.Sqrt(h + w); <br /> <br />Assert.AreEqual(5, hypoteneuse(3, 4));<br /><br /></div><div class="ClearBoth"></div>KodefuGuruTue, 22 Jun 2010 14:19:24 GMTUpdated Wiki: Home 20100622021924PUpdated Wiki: Homehttp://monadic.codeplex.com/wikipage?version=3<div class="wikidoc"><b>Project Description</b><br />Monadic creates monad types for C# in a C# specific manner.<br /><br />This is my own research project to express a few ideas I've been having. I have decided to let it take me where it will and much what is put it in here may not seem practical. If you would like to contribute to this exploration, send me an email... or blog about it!<br /><br />Currently, the List monad is well represented with the extension methods on IEnumerable<T>. I have found that others usually create classes to represent the Bind and Return interface used by monads, but I feel the best way to achieve the functionality of monads in C# is to do it the C# way: with extension methods on existing types. The initial checkin provides the Identity and Maybe monads using extension methods on object.</div><div class="ClearBoth"></div>KodefuGuruSun, 20 Jun 2010 16:36:35 GMTUpdated Wiki: Home 20100620043635P