https://wiki.haskell.org/api.php?action=feedcontributions&user=Drb226&feedformat=atomHaskellWiki - User contributions [en]2016-07-30T04:34:58ZUser contributionsMediaWiki 1.19.14+dfsg-1https://wiki.haskell.org/BayHac2015BayHac20152015-05-16T19:48:31Z<p>Drb226: Created page with "See: http://bayhac.org/"</p>
<hr />
<div>See: http://bayhac.org/</div>Drb226https://wiki.haskell.org/BayHac2014BayHac20142014-06-04T23:52:33Z<p>Drb226: /* Friday */ + slides link for pipes</p>
<hr />
<div>__NOTOC__<br />
<br />
<b><span style="color:#e73">San Francisco Bay Area</span> <span style="color:#aaa">&amp;</span> <span style="color:#930">Silicon Valley</span> <span style="color:#aaa">Haskell Hackathon</span></b><br />
<br />
[[Image:BayHac14_banner.png]]<br />
<br />
Come join a group of Haskell hackers to work on a wide variety of projects. All levels welcome.<br />
<br />
<center><br />
<big>Sign-up Here:<br /> [https://docs.google.com/forms/d/16QEHqAioGQeHHOlnMTEmjdgtO4YNN2_Qc-rbgLOFatU/viewform BayHac '14 Attendee Form]</big><br />
</center><br />
<br />
Special thanks to [http://engineering.imvu.com/ IMVU], [https://developers.google.com/open-source/ Google], Aleph Cloud and Twitter for sponsoring BayHac '14!<br />
<br />
----<br />
<br />
{|<br />
|When:<br />
|Friday, May 16th – Sunday, May 18th, 2014<br />
|-<br />
|Where:<br />
|[http://www.hackerdojo.com/ Hacker Dojo]<br />
|-<br />
|Cost:<br />
|Free<br />
|-<br />
|News and Discussion:<br />
|[http://groups.google.com/group/bayhac BayHac Google Group]<br />
|}<br />
<br />
<br />
<div style="text-align: right; float: right; width: 250px"><br />
[[Image:BayHac14 Poster Small.png|237px]]<br />
<br /><br />
<small><i>[https://drive.google.com/file/d/0B1eCSfs15HPRZjRIWWtCNmJjSms/edit?usp=sharing Full size PDF poster available]</i></small><br />
<br />
</div><br />
== Location ==<br />
<br />
[http://www.hackerdojo.com/ Hacker Dojo], 599 Fairchild Drive, Mountain View, CA ([https://maps.google.com/maps?ie=UTF8&cid=11488539903009648209&q=Hacker+Dojo&iwloc=A&gl=US&hl=en-US Google Map])<br />
<br />
== Schedule ==<br />
<br />
Basic timing... details to be developed. Expect lightning talks, hacking, and other activities:<br />
<br />
{|<br />
|Friday, May 16th<br />
|3pm - 7pm<br />
|-<br />
|Saturday, May 17th<br />
|10am ~ 7pm<br />
|-<br />
|Sunday, May 18th<br />
|10am - 4pm<br />
|}<br />
<br />
== Classes ==<br />
=== Friday ===<br />
* 5:15pm - 6:15pm '''Programming with Pipes''' by Gabriel Gonzalez (Large Room) — [https://drive.google.com/folderview?id=0B60EFlB9qDBNMGhKNHY3NXZLbHM&usp=sharing slides]<br />
* 6:15pm - 7pm '''A Tutorial on Free Monads''' by Dan Piponi (Large Room) — [https://plus.google.com/u/0/events/cu5t5s2g14t4fqmapft5bcatqeg video]<br />
<br />
=== Saturday ===<br />
* 10am - 11am '''Beginning Haskell''' by Bob Ippolito (Small Room) - [http://bob.ippoli.to/beginning-haskell-bayhac-2014/ slides]<br />
* 11am - 12pm '''Haskell for Scala Programmers''' by Runar Bjarnason (Small Room)<br />
* 12 pm - 1pm '''Conquering Cabal''' by Jonathan Fischoff (Small Room)<br />
* 2pm - 3pm [http://johnmacfarlane.net/BayHac2014/ '''Pandoc for Haskell Hackers'''] by John MacFarlane (Small Room)<br />
* 3pm - 4pm [https://github.com/alephcloud/bayhac2014 '''Haste: Front End Web Development with Haskell'''] by Lars Kuhtz (Small Room)<br />
* 4pm - 5pm [http://www.haskell.org/haskellwiki/BayHac2014/Prolog '''From Prolog to Hindley-Milner'''] by Tikhon Jelvis (Small Room)<br />
* 5pm - 6pm [https://goo.gl/gMrmnv '''Yesod: Up and Running'''] by [[User:drb226|Dan Burton]] (Small Room) - [https://www.fpcomplete.com/user/DanBurton/yesod-beginner source]<br />
* 6pm - 7pm '''Lens: Inside and Out''' by Shachaf Ben-Kiki (Small Room)<br />
<br />
=== Sunday ===<br />
* 10am - 11:30am '''GHC iOS: Up and Running''' by Luke Iannini (Small Room)<br />
* 11:30am - 1pm [https://vimeo.com/95694918 '''Programming with Vinyl''' ] by Jonathan Sterling (Small Room) - [https://github.com/VinylRecords/BayHac2014-Talk/blob/master/Talk.pdf slides]<br />
* 1pm - 2pm '''Functional Reactive Programming with Elm''' by Evan Czaplicki (Large Room)<br />
* 2pm - 3pm [https://github.com/conal/talk-2014-bayhac-denotational-design/blob/master/README.md '''Denotational Design: from meanings to programs'''] by Conal Elliott (Large Room)<br />
* 3pm - 4pm [https://docs.google.com/presentation/d/1suMuLRo1xS5NxWn-L9lGHtVNpOH48F9ZnDyv5PyxEpI/edit?usp=sharing '''Getting Stuff Done with Haskell'''] by Greg Weber (Large Room) [https://app.usedox.com/d/rbczklzyvgczkfgh/Getting-it-Done-with-Haskell-pdf view presentation on Dox]<br />
<br />
== Saturday Demos and Experience Reports (Large Room) ==<br />
1pm - 2pm<br />
* '''Haskell at IMVU''' by Andy Friesen<br />
* '''Haskell at Aleph Cloud''' by Jeff Polakow<br />
* '''Haskell at Docmunch''' by Greg Weber<br />
* '''Haskell at Pingwell''' by Tim Sears<br />
* '''Tree.is demo''' by Luke Iannini<br />
<br />
== Lightning Talks ==<br />
<br />
* Aaron Wolf - '''Snowdrift.coop: FLO fundraising built with Yesod'''<br />
* Harold Carr - '''a Haskell Bitly Client using Template Haskell & Aeson'''<br />
* Tad Doxsee - [http://www.planit9.com/blog/learning_web_programming.pdf '''PlanIt9: Learning Web Programming via Haskell (pdf)''']<br />
* Paul Ivanov - '''IHaskell Notebook'''<br />
* Ben Burdotle - '''Cyclophone'''<br />
* John Millikin - '''The "options" package'''<br />
* Jon Sterling - '''Vinyl'''<br />
* Conal Eliot - '''Haskell to HW'''<br />
<br />
== Attendees == <br />
<br />
* Jonathan Fischoff - organizer<br />
* [http://www.ozonehouse.com/mark/ Mark Lentczner] - asst. organizer<br />
* [mailto:capn.freako@gmail.com David Banas] - amateur Haskeller<br />
* [mailto:michael@schmong.org Michael Litchard] - Haskeller<br />
* [http://conal.net Conal Elliott]<br />
* [http://jelv.is Tikhon Jelvis]<br />
<br />
== Projects ==<br />
# [http://www.haskell.org/haskellwiki/Treeviz TreeViz] - a computation breakdown visualization project hosted by [mailto:capn.freako@gmail.com David Banas]<br />
# [https://github.com/haskell/haskell-platform/tree/new-build Haskell Platform, the new build] - We are working on a new build system for all of Haskell Platform: Generating tarballs, installers, and even the web site from one single Shake based build tool. Lots to do! See Mark Lentczner.<br />
# [https://github.com/conal/lambda-ccc/ lambda-ccc] - a project for compiling Haskell to hardware. I'm doing this work for my day job, but the development is open, and the result will be shared freely. The project starts with a GHC plugin that transforms Core in order to generate a convenient-to-manipulate GADT representation of the original. Then convert to an <code>Arrow</code>-like algebraic interface that can be interpreted in various ways, including as circuits. See [mailto:conal@conal.net Conal Elliott].<br />
# [https://ghc.haskell.org/trac/ghc/ticket/8624#comment:12 see what Template Haskell generates]. For those interested in hacking on the GHC compiler, see Greg Weber<br />
# [https://snowdrift.coop Snowdrift.coop] — a community-engagement and fundraising platform strictly for Free/Libre/Open projects, built on Yesod; Head developer David Thomas and co-founder (and Haskell beginner) Aaron Wolf will be on hand. We have a wide range of projects at different levels and sizes to hack on.<br />
<br />
== IRC channel ==<br />
<br />
We'll be hanging out on #bayhac on FreeNode.<br />
<br />
[[Category:Community]]</div>Drb226https://wiki.haskell.org/BayHac2014BayHac20142014-05-19T19:07:40Z<p>Drb226: /* Saturday */ yesod +source</p>
<hr />
<div>__NOTOC__<br />
<br />
<b><span style="color:#e73">San Francisco Bay Area</span> <span style="color:#aaa">&amp;</span> <span style="color:#930">Silicon Valley</span> <span style="color:#aaa">Haskell Hackathon</span></b><br />
<br />
[[Image:BayHac14_banner.png]]<br />
<br />
Come join a group of Haskell hackers to work on a wide variety of projects. All levels welcome.<br />
<br />
<center><br />
<big>Sign-up Here:<br /> [https://docs.google.com/forms/d/16QEHqAioGQeHHOlnMTEmjdgtO4YNN2_Qc-rbgLOFatU/viewform BayHac '14 Attendee Form]</big><br />
</center><br />
<br />
Special thanks to [http://engineering.imvu.com/ IMVU], [https://developers.google.com/open-source/ Google], Aleph Cloud and Twitter for sponsoring BayHac '14!<br />
<br />
----<br />
<br />
{|<br />
|When:<br />
|Friday, May 16th – Sunday, May 18th, 2014<br />
|-<br />
|Where:<br />
|[http://www.hackerdojo.com/ Hacker Dojo]<br />
|-<br />
|Cost:<br />
|Free<br />
|-<br />
|News and Discussion:<br />
|[http://groups.google.com/group/bayhac BayHac Google Group]<br />
|}<br />
<br />
<br />
<div style="text-align: right; float: right; width: 250px"><br />
[[Image:BayHac14 Poster Small.png|237px]]<br />
<br /><br />
<small><i>[https://drive.google.com/file/d/0B1eCSfs15HPRZjRIWWtCNmJjSms/edit?usp=sharing Full size PDF poster available]</i></small><br />
<br />
</div><br />
== Location ==<br />
<br />
[http://www.hackerdojo.com/ Hacker Dojo], 599 Fairchild Drive, Mountain View, CA ([https://maps.google.com/maps?ie=UTF8&cid=11488539903009648209&q=Hacker+Dojo&iwloc=A&gl=US&hl=en-US Google Map])<br />
<br />
== Schedule ==<br />
<br />
Basic timing... details to be developed. Expect lightning talks, hacking, and other activities:<br />
<br />
{|<br />
|Friday, May 16th<br />
|3pm - 7pm<br />
|-<br />
|Saturday, May 17th<br />
|10am ~ 7pm<br />
|-<br />
|Sunday, May 18th<br />
|10am - 4pm<br />
|}<br />
<br />
== Classes ==<br />
=== Friday ===<br />
* 5:15pm - 6:15pm '''Programming with Pipes''' by Gabriel Gonzalez (Large Room)<br />
* 6:15pm - 7pm '''A Tutorial on Free Monads''' by Dan Piponi (Large Room) — [https://plus.google.com/u/0/events/cu5t5s2g14t4fqmapft5bcatqeg video]<br />
<br />
=== Saturday ===<br />
* 10am - 11am '''Beginning Haskell''' by Bob Ippolito (Small Room) - [http://bob.ippoli.to/beginning-haskell-bayhac-2014/ slides]<br />
* 11am - 12pm '''Haskell for Scala Programmers''' by Runar Bjarnason (Small Room)<br />
* 12 pm - 1pm '''Conquering Cabal''' by Jonathan Fischoff (Small Room)<br />
* 2pm - 3pm '''Pandoc''' by John MacFarlane (Small Room)<br />
* 3pm - 4pm '''Haste: Front End Web Development with Haskell''' by Lars Kuhtz (Small Room)<br />
* 4pm - 5pm '''From Prolog to Hindley-Milner''' by Tikhon Jelvis (Small Room)<br />
* 5pm - 6pm [https://goo.gl/gMrmnv '''Yesod: Up and Running'''] by [[User:drb226|Dan Burton]] (Small Room) - [https://www.fpcomplete.com/user/DanBurton/yesod-beginner source]<br />
* 6pm - 7pm '''Lens: Inside and Out''' by Shachaf Ben-Kiki (Small Room)<br />
<br />
=== Sunday ===<br />
* 10am - 11:30am '''GHC iOS: Up and Running''' by Luke Iannini (Small Room)<br />
* 11:30am - 1pm '''Programming with Vinyl''' by Jonathan Sterling (Small Room) - [https://github.com/VinylRecords/BayHac2014-Talk/blob/master/Talk.pdf slides]<br />
* 1pm - 2pm '''Functional Reactive Programming with Elm''' by Evan Czaplicki (Large Room)<br />
* 2pm - 3pm [http://www.haskell.org/haskellwiki/BayHac2014/DenotationalDesign '''Denotational Design: from meanings to programs'''] by Conal Elliott (Large Room)<br />
* 3pm - 4pm [https://docs.google.com/presentation/d/1suMuLRo1xS5NxWn-L9lGHtVNpOH48F9ZnDyv5PyxEpI/edit?usp=sharing '''Getting Stuff Done with Haskell'''] by Greg Weber (Large Room) [https://app.usedox.com/#/r/rbczklzyvgczkfgh/Getting-it-Done-with-Haskell-1-pdf view presentation on Dox]<br />
<br />
== Saturday Demos and Experience Reports (Large Room) ==<br />
1pm - 2pm<br />
* '''Haskell at IMVU''' by Andy Friesen<br />
* '''Haskell at Aleph Cloud''' by Jeff Polakow<br />
* '''Haskell at Docmunch''' by Greg Weber<br />
* '''Haskell at Pingwell''' by Tim Sears<br />
* '''Tree.is demo''' by Luke Iannini<br />
<br />
== Lightning Talks ==<br />
<br />
* Aaron Wolf - '''Snowdrift.coop: FLO fundraising built with Yesod'''<br />
* Harold Carr - '''a Haskell Bitly Client using Template Haskell & Aeson'''<br />
* Tad Doxsee - '''Learning Web Programming via Haskell'''<br />
* Paul Ivanov - '''IHaskell Notebook'''<br />
* Ben Burdotle - '''Cyclophone'''<br />
* John Millikin - '''The "options" package'''<br />
* Jon Sterling - '''Vynal'''<br />
* Conal Eliot - '''Haskell to HW'''<br />
<br />
== Attendees == <br />
<br />
* Jonathan Fischoff - organizer<br />
* [http://www.ozonehouse.com/mark/ Mark Lentczner] - asst. organizer<br />
* [mailto:capn.freako@gmail.com David Banas] - amateur Haskeller<br />
* [mailto:michael@schmong.org Michael Litchard] - Haskeller<br />
* [http://conal.net Conal Elliott]<br />
* [http://jelv.is Tikhon Jelvis]<br />
<br />
== Projects ==<br />
# [http://www.haskell.org/haskellwiki/Treeviz TreeViz] - a computation breakdown visualization project hosted by [mailto:capn.freako@gmail.com David Banas]<br />
# [https://github.com/haskell/haskell-platform/tree/new-build Haskell Platform, the new build] - We are working on a new build system for all of Haskell Platform: Generating tarballs, installers, and even the web site from one single Shake based build tool. Lots to do! See Mark Lentczner.<br />
# [https://github.com/conal/lambda-ccc/ lambda-ccc] - a project for compiling Haskell to hardware. I'm doing this work for my day job, but the development is open, and the result will be shared freely. The project starts with a GHC plugin that transforms Core in order to generate a convenient-to-manipulate GADT representation of the original. Then convert to an <code>Arrow</code>-like algebraic interface that can be interpreted in various ways, including as circuits. See [mailto:conal@conal.net Conal Elliott].<br />
# [https://ghc.haskell.org/trac/ghc/ticket/8624#comment:12 see what Template Haskell generates]. For those interested in hacking on the GHC compiler, see Greg Weber<br />
# [https://snowdrift.coop Snowdrift.coop] — a community-engagement and fundraising platform strictly for Free/Libre/Open projects, built on Yesod; Head developer David Thomas and co-founder (and Haskell beginner) Aaron Wolf will be on hand. We have a wide range of projects at different levels and sizes to hack on.<br />
<br />
== IRC channel ==<br />
<br />
We'll be hanging out on #bayhac on FreeNode.<br />
<br />
[[Category:Community]]</div>Drb226https://wiki.haskell.org/User:Drb226User:Drb2262014-05-19T19:04:34Z<p>Drb226: </p>
<hr />
<div>Hi, I'm Dan Burton. You may know me as:<br />
<br />
* [http://www.reddit.com/user/drb226/ drb226 on reddit]<br />
* [http://stackoverflow.com/users/208257/dan-burton Dan Burton on StackOverflow]<br />
* "DanBurton" on #haskell IRC<br />
* [https://plus.google.com/101638406996764973147/posts Dan Burton on Google+]<br />
* [http://twitter.com/#!/drb226 drb226 on twitter]<br />
* <s>The only Utahn to sign up on http://haskellers.com (double click on the map a few times to zoom in; look at Utah :)</s> I live in the San Francisco Bay Area now. Bye, Utah. Glad to see some other Utahn Haskellers have registered.</div>Drb226https://wiki.haskell.org/BayHac2014BayHac20142014-05-19T18:59:10Z<p>Drb226: /* Saturday */ links for yesod class</p>
<hr />
<div>__NOTOC__<br />
<br />
<b><span style="color:#e73">San Francisco Bay Area</span> <span style="color:#aaa">&amp;</span> <span style="color:#930">Silicon Valley</span> <span style="color:#aaa">Haskell Hackathon</span></b><br />
<br />
[[Image:BayHac14_banner.png]]<br />
<br />
Come join a group of Haskell hackers to work on a wide variety of projects. All levels welcome.<br />
<br />
<center><br />
<big>Sign-up Here:<br /> [https://docs.google.com/forms/d/16QEHqAioGQeHHOlnMTEmjdgtO4YNN2_Qc-rbgLOFatU/viewform BayHac '14 Attendee Form]</big><br />
</center><br />
<br />
Special thanks to [http://engineering.imvu.com/ IMVU], [https://developers.google.com/open-source/ Google], Aleph Cloud and Twitter for sponsoring BayHac '14!<br />
<br />
----<br />
<br />
{|<br />
|When:<br />
|Friday, May 16th – Sunday, May 18th, 2014<br />
|-<br />
|Where:<br />
|[http://www.hackerdojo.com/ Hacker Dojo]<br />
|-<br />
|Cost:<br />
|Free<br />
|-<br />
|News and Discussion:<br />
|[http://groups.google.com/group/bayhac BayHac Google Group]<br />
|}<br />
<br />
<br />
<div style="text-align: right; float: right; width: 250px"><br />
[[Image:BayHac14 Poster Small.png|237px]]<br />
<br /><br />
<small><i>[https://drive.google.com/file/d/0B1eCSfs15HPRZjRIWWtCNmJjSms/edit?usp=sharing Full size PDF poster available]</i></small><br />
<br />
</div><br />
== Location ==<br />
<br />
[http://www.hackerdojo.com/ Hacker Dojo], 599 Fairchild Drive, Mountain View, CA ([https://maps.google.com/maps?ie=UTF8&cid=11488539903009648209&q=Hacker+Dojo&iwloc=A&gl=US&hl=en-US Google Map])<br />
<br />
== Schedule ==<br />
<br />
Basic timing... details to be developed. Expect lightning talks, hacking, and other activities:<br />
<br />
{|<br />
|Friday, May 16th<br />
|3pm - 7pm<br />
|-<br />
|Saturday, May 17th<br />
|10am ~ 7pm<br />
|-<br />
|Sunday, May 18th<br />
|10am - 4pm<br />
|}<br />
<br />
== Classes ==<br />
=== Friday ===<br />
* 5:15pm - 6:15pm '''Programming with Pipes''' by Gabriel Gonzalez (Large Room)<br />
* 6:15pm - 7pm '''A Tutorial on Free Monads''' by Dan Piponi (Large Room) — [https://plus.google.com/u/0/events/cu5t5s2g14t4fqmapft5bcatqeg video]<br />
<br />
=== Saturday ===<br />
* 10am - 11am '''Beginning Haskell''' by Bob Ippolito (Small Room) - [http://bob.ippoli.to/beginning-haskell-bayhac-2014/ slides]<br />
* 11am - 12pm '''Haskell for Scala Programmers''' by Runar Bjarnason (Small Room)<br />
* 12 pm - 1pm '''Conquering Cabal''' by Jonathan Fischoff (Small Room)<br />
* 2pm - 3pm '''Pandoc''' by John MacFarlane (Small Room)<br />
* 3pm - 4pm '''Haste: Front End Web Development with Haskell''' by Lars Kuhtz (Small Room)<br />
* 4pm - 5pm '''From Prolog to Hindley-Milner''' by Tikhon Jelvis (Small Room)<br />
* 5pm - 6pm [https://goo.gl/gMrmnv '''Yesod: Up and Running'''] by [[User:drb226|Dan Burton]] (Small Room)<br />
* 6pm - 7pm '''Lens: Inside and Out''' by Shachaf Ben-Kiki (Small Room)<br />
<br />
=== Sunday ===<br />
* 10am - 11:30am '''GHC iOS: Up and Running''' by Luke Iannini (Small Room)<br />
* 11:30am - 1pm '''Programming with Vinyl''' by Jonathan Sterling (Small Room) - [https://github.com/VinylRecords/BayHac2014-Talk/blob/master/Talk.pdf slides]<br />
* 1pm - 2pm '''Functional Reactive Programming with Elm''' by Evan Czaplicki (Large Room)<br />
* 2pm - 3pm [http://www.haskell.org/haskellwiki/BayHac2014/DenotationalDesign '''Denotational Design: from meanings to programs'''] by Conal Elliott (Large Room)<br />
* 3pm - 4pm [https://docs.google.com/presentation/d/1suMuLRo1xS5NxWn-L9lGHtVNpOH48F9ZnDyv5PyxEpI/edit?usp=sharing '''Getting Stuff Done with Haskell'''] by Greg Weber (Large Room) [https://app.usedox.com/#/r/rbczklzyvgczkfgh/Getting-it-Done-with-Haskell-1-pdf view presentation on Dox]<br />
<br />
== Saturday Demos and Experience Reports (Large Room) ==<br />
1pm - 2pm<br />
* '''Haskell at IMVU''' by Andy Friesen<br />
* '''Haskell at Aleph Cloud''' by Jeff Polakow<br />
* '''Haskell at Docmunch''' by Greg Weber<br />
* '''Haskell at Pingwell''' by Tim Sears<br />
* '''Tree.is demo''' by Luke Iannini<br />
<br />
== Lightning Talks ==<br />
<br />
* Aaron Wolf - '''Snowdrift.coop: FLO fundraising built with Yesod'''<br />
* Harold Carr - '''a Haskell Bitly Client using Template Haskell & Aeson'''<br />
* Tad Doxsee - '''Learning Web Programming via Haskell'''<br />
* Paul Ivanov - '''IHaskell Notebook'''<br />
* Ben Burdotle - '''Cyclophone'''<br />
* John Millikin - '''The "options" package'''<br />
* Jon Sterling - '''Vynal'''<br />
* Conal Eliot - '''Haskell to HW'''<br />
<br />
== Attendees == <br />
<br />
* Jonathan Fischoff - organizer<br />
* [http://www.ozonehouse.com/mark/ Mark Lentczner] - asst. organizer<br />
* [mailto:capn.freako@gmail.com David Banas] - amateur Haskeller<br />
* [mailto:michael@schmong.org Michael Litchard] - Haskeller<br />
* [http://conal.net Conal Elliott]<br />
* [http://jelv.is Tikhon Jelvis]<br />
<br />
== Projects ==<br />
# [http://www.haskell.org/haskellwiki/Treeviz TreeViz] - a computation breakdown visualization project hosted by [mailto:capn.freako@gmail.com David Banas]<br />
# [https://github.com/haskell/haskell-platform/tree/new-build Haskell Platform, the new build] - We are working on a new build system for all of Haskell Platform: Generating tarballs, installers, and even the web site from one single Shake based build tool. Lots to do! See Mark Lentczner.<br />
# [https://github.com/conal/lambda-ccc/ lambda-ccc] - a project for compiling Haskell to hardware. I'm doing this work for my day job, but the development is open, and the result will be shared freely. The project starts with a GHC plugin that transforms Core in order to generate a convenient-to-manipulate GADT representation of the original. Then convert to an <code>Arrow</code>-like algebraic interface that can be interpreted in various ways, including as circuits. See [mailto:conal@conal.net Conal Elliott].<br />
# [https://ghc.haskell.org/trac/ghc/ticket/8624#comment:12 see what Template Haskell generates]. For those interested in hacking on the GHC compiler, see Greg Weber<br />
# [https://snowdrift.coop Snowdrift.coop] — a community-engagement and fundraising platform strictly for Free/Libre/Open projects, built on Yesod; Head developer David Thomas and co-founder (and Haskell beginner) Aaron Wolf will be on hand. We have a wide range of projects at different levels and sizes to hack on.<br />
<br />
== IRC channel ==<br />
<br />
We'll be hanging out on #bayhac on FreeNode.<br />
<br />
[[Category:Community]]</div>Drb226https://wiki.haskell.org/BayHac2014BayHac20142014-03-15T18:33:33Z<p>Drb226: /* Schedule */ .</p>
<hr />
<div>__NOTOC__<br />
<br />
[[Image:BayHac13_banner.png]]<br />
<br />
<b><span style="color:#e73">San Francisco Bay Area</span> <span style="color:#aaa">&amp;</span> <span style="color:#930">Silicon Valley</span> <span style="color:#aaa">Haskell Hackathon</span></b><br />
<br />
Come join a group of Haskell hackers to work on a wide variety of projects. All levels welcome.<br />
<br />
Special thanks to [https://developers.google.com/open-source/ Google] for sponsoring BayHac '14, who will be providing a '''lunch''' again!<br />
<br />
----<br />
{|<br />
|When:<br />
|Friday, May 16th – Sunday, May 18th, 2014<br />
|-<br />
|Where:<br />
|[http://www.hackerdojo.com/ Hacker Dojo]<br />
|-<br />
|Cost:<br />
|Free<br />
|-<br />
|News and Discussion:<br />
|[http://groups.google.com/group/bayhac BayHac Google Group]<br />
|}<br />
<br />
<big>Details and sign-up form to follow in April.</big><br />
<br />
== Location ==<br />
<br />
[http://www.hackerdojo.com/ Hacker Dojo], 599 Fairchild Drive, Mountain View, CA ([https://maps.google.com/maps?ie=UTF8&cid=11488539903009648209&q=Hacker+Dojo&iwloc=A&gl=US&hl=en-US Google Map])<br />
<br />
== Schedule ==<br />
<br />
Basic timing... details to be developed. Expect lightening talks, hacking, and other activities:<br />
<br />
{|<br />
|Friday, May 16th<br />
|3pm - 7pm<br />
|-<br />
|Saturday, May 17th<br />
|10am ~ 7pm<br />
|-<br />
|Sunday, May 18th<br />
|10am - 4pm<br />
|}<br />
<br />
== Lightning Talks ==<br />
<br />
== Attendees == <br />
<br />
# Jonathan Fischoff - organizer<br />
# [http://www.ozonehouse.com/mark/ Mark Lentczner] - asst. organizer<br />
<br />
== Projects ==<br />
<br />
== IRC channel ==<br />
<br />
We'll be hanging out on #bayhac on FreeNode.<br />
<br />
[[Category:Community]]</div>Drb226https://wiki.haskell.org/IDEsIDEs2013-09-06T17:07:32Z<p>Drb226: /* FP Haskell Center */ timestamp</p>
<hr />
<div>The IDE world in Haskell is incomplete, but is in motion. There are many choices. When choosing your IDE, there are the following things to consider.<br />
<br />
== Notable features of interest to consider ==<br />
<br />
This is a list of features that any Haskell IDE could or should have. The IDEs listed above generally support some subset of these features. Please add more to this list if you think of anything. In future this should be expanded into separate headings with more description of how they would desirably work.<br />
<br />
* Syntax highlighting (e.g. for Haskell, Cabal, Literate Haskell, Core, etc.)<br />
* Macros (e.g. inserting imports/aligning/sorting imports, aligning up text, transposing/switching/moving things around)<br />
* Type information (e.g. type at point, info at point, type of expression)<br />
* Intellisense/completion (e.g. jump-to-definition, who-calls, calls-who, search by type, completion, etc.)<br />
* Project management (e.g. understanding of Cabal, configuration/building/installing, package sandboxing)<br />
* Interactive REPL (e.g. GHCi/Hugs interaction, expression evaluation and such)<br />
* Knowledge of Haskell in the GHCi/GHC side (e.g. understanding error types, the REPL, REPL objects, object inspection)<br />
* Indentation support (e.g. tab cycle, simple back-forward indentation, whole area indentation, structured editing, etc.)<br />
* Proper syntactic awareness of Haskell (e.g. with a proper parser and proper editor transpositions a la the structured editors of the 80s and Isabel et al)<br />
* Documentation support (e.g. ability to call up documentation of symbol or module, either in the editor, or in the browser)<br />
* Debugger support (e.g. stepping, breakpoints, etc.)<br />
* Refactoring support (e.g. symbol renaming, hlint, etc.)<br />
* Templates (e.g. snippets, zencoding type stuff, filling in all the cases of a case, etc.)<br />
<br />
== Software ==<br />
<br />
=== [http://www.haskell.org/visualhaskell Visual Haskell] ===<br />
:Visual Haskell is a complete development environment for Haskell software, based on Microsoft's [http://www.microsoft.com/visualstudio/en-us Microsoft Visual Studio] platform. Visual Haskell integrates with the Visual Studio editor to provide interactive features to aid Haskell development, and it enables the construction of projects consisting of multiple Haskell modules, using the Cabal building/packaging infrastructure.<br />
<br />
=== [http://eclipsefp.github.com/ EclipseFP plugin for Eclipse IDE] ===<br />
:Eclipse is an open, extensible IDE platform for "everything and nothing in particular". It is implemented in Java and runs on several platforms. The Java IDE built on top of it has already become very popular among Java developers. The Haskell tools extend it to support editing (syntax coloring, code assist), compiling, and running Haskell programs from within the IDE. In more details, it features:<br />
:* Syntax highlighting and errors/warning highlighting<br />
:* A module browser showing all installed packages, their modules and the contents of the modules (functions, types, etc.)<br />
:* Integration with [http://www.haskell.org/hoogle/ Hoogle]: select an identifier in your code, press F4 and see the results in hoogle<br />
:* Code navigation: from within a Haskell source file, jump to the file where a symbol in declared, or everywhere a symbol is used (type sensitive search, not just a text search)<br />
:* Outline view: quickly jump to definitions in your file<br />
:* Quick fixes on common errors and import management<br />
:* A cabal file editor and integration with Cabal (uses cabal configure, cabal build under the covers), and a graphical view of installed packages<br />
:* Integration with GHCi: launch GHCi inside Eclipse on any module<br />
:* Integration with the GHCi debugger: performs the GHCi debugging commands for you from the standard Eclipse debugging interface<br />
:* Integration with [http://community.haskell.org/~ndm/hlint/ HLint]: gives you HLint warning on building and allows you to quick fix them<br />
:* Integration with [https://github.com/jaspervdj/stylish-haskell Stylish-Haskell]: format your code with stylish-haskell<br />
:* Test support: shows results of test-framework based test suite in a graphical format. HTF support to come soon.<br />
<br />
=== [http://colorer.sourceforge.net/eclipsecolorer/index.html Colorer plugin for Eclipse IDE] ===<br />
:Syntax highlighting in Eclipse can be achieved using the Colorer plugin. This is more light weight than using the EclipseFP plugin which has much functionality but can be messy to install and has sometimes been a bit shaky.<br />
<br />
:Eclipse Colorer is a plugin that enables syntax highlighting for a wide range of languages. It uses its own XML-based language for describing syntactic regions of languages. It does not include support for Haskell by default, but this can be added using the syntax description files attached below.<br />
<br />
:<b>Installation instructions</b><br />
:# Install the Colorer from the update site <code>http://colorer.sf.net/eclipsecolorer/</code> (for more detailed instructions see the project page).<br />
:# Download the Haskell syntax description files in [http://www.haskell.org/wikiupload/1/16/Haskell_Eclipse_Colorer.tar.gz Haskell_Eclipse_Colorer.tar.gz].<br />
:#Extract its contents (haskell.hrc and proto.hrc) into the following directory (overwriting proto.hrc): <code>eclipse_installation_dir/plugins/net.sf.colorer_0.9.9/colorer/hrc</code> (sometimes the wiki seems to create a nesting tar file, so you might have to unpack twise).<br />
:# Finished. A restart of Eclipse might be required. .hs files should open with syntax highlighting.<br />
<br />
:<b>Tips</b><br />
:* If .hs files open with another kind of syntax highlighting check that they are associated with the Colorer Editor (Preferences -> General -> Editors -> File Associations). Or right click on them and choose Open With -> Other -> Colorer Editor.<br />
:* Sometimes the highlighting gets confused. Then it might help to press Ctrl+R and re-colour the editor.<br />
:* Use the Word Completion feature (Shift+Alt+7) as a poor man's content assist.<br />
:* Use the standard External Tools feature in Eclipse to invoke the compiler from inside the IDE.<br />
:* Use the Block selection feature (Shift+Alt+A) to insert/remove line comments on multiple lines at the same time.<br />
:* Some other useful standard Eclipse features include the Open resource command (Ctrl+Shift+R), the File search command (Ctrl+H) and the bookmarks feature (Edit -> Add bookmark). Make sure to check Include in next/prev navigation box (Windows -> Preferences -> General -> Editors -> Text Editors -> Annotations -> Bookmarks).<br />
<br />
=== [[Leksah]] ===<br />
:Leksah is an IDE for Haskell written in Haskell. Leksah is intended as a practical tool to support the Haskell development process. It is an pre-release phase with bugs and open ends but actively developed and moving quickly. Hopefully, Leksah will already be interesting, useful and fun. Leksah uses GTK+ as GUI Toolkit with the gtk2hs binding. It is platform independent and should run on any platform where GTK+, gtk2hs and GHC can be installed. I have tested it on Windows and Linux. It only supports GHC.<br />
<br />
"I found Leksah less than satisfactory on OS X Lion. I could not figure out how to reference Test.Unit in a very simple program after several hours of trying to find the right settings in Leksah, and Leksah crashes a lot. I was able to build the same program in Eclipse within a few minutes of installing Eclipse and [http://eclipsefp.github.com/ Haskell support for Eclipse]." -- Doug Ransom<br />
<br />
- is the above still relevant? I did have to read the manual, the section concerning setting up a project (including dependencies), as leksah requires you to, but did not notice any issues, described above. Stability does not seem to be an issue either. -- Vladimir Lopatin.<br />
<br />
=== [http://www.haskell.org/haskellwiki/HIDE hIDE] ===<br />
:hIDE is a GUI-based Haskell IDE written using gtk+hs. It does not include an editor but instead interfaces with NEdit, vim or GNU emacs.<br />
<br />
=== [http://www.haskell.org/haskellwiki/HIDE hIDE-2] ===<br />
:Through the dark ages many a programmer has longed for the ultimate tool. In response to this most unnerving craving, of which we ourselves have had maybe more than our fair share, the dynamic trio of #Haskellaniacs (dons, dcoutts and Lemmih) hereby announce, to the relief of the community, that a fetus has been conceived: ''hIDE - the Haskell Integrated Development Environment''. So far the unborn integrates source code recognition and a chameleon editor, resenting these in a snappy gtk2 environment. Although no seer has yet predicted the date of birth of our hIDEous creature, we hope that the mere knowledge of its existence will spread peace of mind throughout the community as oil on troubled waters. See also: [[HIDE/Screenshots of HIDE]] and [[HIDE]]<br />
<br />
=== [http://web.archive.org/web/20060213161530/http://www.students.cs.uu.nl/people/rjchaaft/JCreator/ JCreator with Haskell support] ===<br />
: <b>N.B. The link above is to the Wayback Machine (Web Archive); it seem that JCreator is no longer supported.</b><br />
:JCreator is a highly customizable Java IDE for Windows. Features include extensive project support, fully customizable toolbars (including the images of user tools) and menus, increase/decrease indent for a selected block of text (tab/shift+tab respectively). The Haskell support module adds syntax highlighting for Haskell files and WinHugs, hugs, a static checker (if you double click on the error message, JCreator will jump to the right file and line and highlight it yellow) and the Haskell 98 Report as tools. Platforms: Win95, Win98, WinNT and Win2000 (only Win95 not tested yet). Size: 6MB. JCreator is a trademark of Xinox Software; Copyright &copy; 2000 Xinox Software. The Haskell support module is made by Rijk-Jan van Haaften.<br />
<br />
=== [http://kdevelop.org/ KDevelop] ===<br />
:This IDE supports many languages. For Haskell it currently supports project management, syntax highlighting, building (with GHC) & executing within the IDE.<br />
<br />
=== [[haste]] - Haskell TurboEdit ===<br />
:haste - Haskell TurboEdit - was an IDE for the functional programming language Haskell, written in Haskell.<br />
<br />
=== [http://www.cs.kent.ac.uk/projects/vital/ Vital] ===<br />
:Vital is a visual programming environment. It is particularly intended for supporting the open-ended, incremental style of development often preferred by end users (engineers, scientists, analysts, etc.).<br />
<br />
=== [http://www.cs.kent.ac.uk/projects/pivotal/ Pivotal] ===<br />
:Pivotal 0.025 is an early prototype of a Vital-like environment for Haskell. Unlike Vital, however, Pivotal is implemented entirely in Haskell. The implementation is based on the use of the hs-plugins library to allow dynamic compilation and evaluation of Haskell expressions together with the gtk2hs library for implementing the GUI.<br />
<br />
=== [http://www.vim.org Vim] ===<br />
<br />
This may or may not be up to date. A Vim user should update it.<br />
<br />
:* [http://projects.haskell.org/haskellmode-vim/ Haskell mode for Vim by Claus Reinke] - These plugins provide Vim integration with GHC and Haddock.<br />
:* [https://github.com/scrooloose/syntastic Syntastic] -- An extremely useful Vim plugin which will interact with ghc_mod (when editing a Haskell file) every time the source file is saved to check for syntax and type errors.<br />
:* [http://www.vim.org/scripts/script.php?script_id=2356 SHIM by Lars Kotthoff] -- Superior Haskell Interaction Mode (SHIM) plugin for Vim providing full GHCi integration (requires Vim compiled with Ruby support).<br />
:* [http://www.vim.org/scripts/script.php?script_id=3200 Haskell Conceal] -- shows Unicode symbols for common Haskell operators such as ++ and other lexical notation in Vim window (source file itself remains unchanged).<br />
:* [http://urchin.earth.li/~ian/vim/ by Ian Lynagh]: distinguishes different literal Haskell styles (Vim 7.0 includes a syntax file which supersedes these plugins).<br />
:* There's a [[Literate programming/Vim|copy of lhaskell.vim]] on the Wiki.<br />
:* [https://github.com/MarcWeber/vim-addon-haskell by Marc Weber] -- Vim script-based function/module completion, cabal support, tagging by one command, context completion ( w<tab> -> where ), module outline, etc<br />
:* [http://www.vim.org/scripts/script.php?script_id=1968 Vim indenting mode for Haskell]<br />
:* [https://github.com/ujihisa/neco-ghc neco-ghc] pragma, module, function completion.<br />
:* [https://github.com/eagletmt/ghcmod-vim Ghcmod-vim]<br />
:* [https://github.com/bitc/vim-hdevtools Hdevtools] - gives type information, quicker reloading and more.<br />
:* [http://blog-mno2.csie.org/blog/2011/11/17/vim-plugins-for-haskell-programmers/ Addition list] with some missing here with screen shots of many of the above.<br />
<br />
=== [http://www.gnu.org/s/emacs/ Emacs] ===<br />
<br />
See [[Emacs]].<br />
<br />
=== Other IDEs ===<br />
<br />
The list below is incomplete. Please add to it with whatever you think of. This list should be expanded into sections, as above, with more details, with links to the actual documentation of the described features.<br />
<br />
* Vim — '''PROS:''' Free. Works on Windows. Works in terminal. Decent alignment support. Tag-based completion and jumps. Very good syntax highlighting, flymake (via Syntastic), Cabal integration, Hoogle. Documentation for symbol at point '''CONS:''' Arcane, difficult for new users. Some complain of bad indentation support.<br />
* [http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs Emacs]— '''PROS:''' Free. Works on Windows. Works in terminal. Decent alignment, indentation, syntax highlighting. Limited type information (type and info of name at point). Cabal/GHC/GHCi awareness and Haskell-aware REPL. Completion and jump-to-definition (via ETAGS). Documentation of symbol at point. Hoogle. Documentation for symbol at point. Flymake (error checking on the fly). '''CONS:''' Arcane, difficult for new users.<br />
* Sublime — '''PROS:''' Works on Windows. '''CONS:''' Poor alignment support (though [http://www.reddit.com/r/haskell/comments/ts8fi/haskell_ides_emacs_vim_and_sublime_oh_my_opinions/c4pair1 there are packages] to do indentation a little better). Proprietary.<br />
* [[Yi]] — '''PROS:''' Written in Haskell. Works in terminal. '''CONS:''' Very immature, lacking features. Problems building generally, especially on Windows.<br />
* [http://www.haskell.org/haskellwiki/Leksah Leksah] — '''PROS:''' Syntax highlighting. Understands Cabal, Module browser, dependency knowledge, documentation display inside the IDE, jump-to-definition, flymake (error checking on the fly), limited evaluation of snippets, scratch buffer. Autocompletion. Not an arcane interface a la Emacs/Vim. '''CONS:''' Doesn't have a decent REPL. Are there any other cons? — This should be moved to the section above.<br />
* [http://www.haskell.org/visualhaskell/ Visual Haskell]<br />
* [http://www.haskell.org/haskellwiki/Editors Other]<br />
* KDevelop — Decent project management.<br />
* [http://www.cs.kent.ac.uk/projects/heat/ HEAT:] An Interactive Development Environment for Learning & Teaching Haskell<br />
* [http://www.geany.org/ Geany] '''PROS:''' Free. Works on Windows. Syntax highlighting, REPL. '''CONS:''' After using it for a while, Geany freezes quite often.<br />
<br />
== Cloud ==<br />
<br />
=== [https://www.fpcomplete.com/business/haskell-center/overview/ FP Haskell Center] ===<br />
<br />
FP Complete has developed a commercial Haskell IDE.<br />
<br />
It's in the cloud, and comes with all of the libraries on Stackage ready to go. (Basically, the Haskell Platform on steroids.)<br />
<br />
It's "in the cloud," which has its pros and cons. The editor is entirely in your browser, and has integration with Github. One particularly cool feature is that you can spin up temporary web servers to test out the Haskell-powered website you might be coding up. It's really easy, and you can pay for FP Complete to host your permanent application, too.<br />
<br />
There's a free trial, with free academic licenses and paid commercial licenses. There will be "personal" licenses in a few weeks (from early Sept 2013) as well, since the commercial pricing is a bit steep for hobbyists.<br />
<br />
== See also ==<br />
<br />
<br />
* [http://blog.johantibell.com/2011/08/results-from-state-of-haskell-2011.html Results from the State of Haskell, 2011 Survey]. <br />
* [http://nickknowlson.com/blog/2011/09/12/haskell-survey-categorized-weaknesses/ Categorized Weaknesses from the State of Haskell 2011 Survey], which barely touched upon IDEs.<br />
* [[Editors]]<br />
* [[Applications and libraries/Program development#Editor support]]<br />
* [http://code.haskell.org/shim/ Shim]; the aim of the shim (Superior Haskell Interaction Mode) project is to provide better support for editing Haskell code in VIM and Emacs<br />
<br />
== Outdated ==<br />
<br />
* [http://web.archive.org/web/20110726153330/http://hoovy.org/HaskellXcodePlugin/ plugin for Xcode] (links to the web archive)<br />
* [[hIDE]], now apparently orphaned</div>Drb226https://wiki.haskell.org/IDEsIDEs2013-09-05T23:10:16Z<p>Drb226: /* See also */ FP Haskell Center - just copy/pasting most of what I wrote for SO</p>
<hr />
<div>The IDE world in Haskell is incomplete, but is in motion. There are many choices. When choosing your IDE, there are the following things to consider.<br />
<br />
== Notable features of interest to consider ==<br />
<br />
This is a list of features that any Haskell IDE could or should have. The IDEs listed above generally support some subset of these features. Please add more to this list if you think of anything. In future this should be expanded into separate headings with more description of how they would desirably work.<br />
<br />
* Syntax highlighting (e.g. for Haskell, Cabal, Literate Haskell, Core, etc.)<br />
* Macros (e.g. inserting imports/aligning/sorting imports, aligning up text, transposing/switching/moving things around)<br />
* Type information (e.g. type at point, info at point, type of expression)<br />
* Intellisense/completion (e.g. jump-to-definition, who-calls, calls-who, search by type, completion, etc.)<br />
* Project management (e.g. understanding of Cabal, configuration/building/installing, package sandboxing)<br />
* Interactive REPL (e.g. GHCi/Hugs interaction, expression evaluation and such)<br />
* Knowledge of Haskell in the GHCi/GHC side (e.g. understanding error types, the REPL, REPL objects, object inspection)<br />
* Indentation support (e.g. tab cycle, simple back-forward indentation, whole area indentation, structured editing, etc.)<br />
* Proper syntactic awareness of Haskell (e.g. with a proper parser and proper editor transpositions a la the structured editors of the 80s and Isabel et al)<br />
* Documentation support (e.g. ability to call up documentation of symbol or module, either in the editor, or in the browser)<br />
* Debugger support (e.g. stepping, breakpoints, etc.)<br />
* Refactoring support (e.g. symbol renaming, hlint, etc.)<br />
* Templates (e.g. snippets, zencoding type stuff, filling in all the cases of a case, etc.)<br />
<br />
== Software ==<br />
<br />
=== [http://www.haskell.org/visualhaskell Visual Haskell] ===<br />
:Visual Haskell is a complete development environment for Haskell software, based on Microsoft's [http://www.microsoft.com/visualstudio/en-us Microsoft Visual Studio] platform. Visual Haskell integrates with the Visual Studio editor to provide interactive features to aid Haskell development, and it enables the construction of projects consisting of multiple Haskell modules, using the Cabal building/packaging infrastructure.<br />
<br />
=== [http://eclipsefp.github.com/ EclipseFP plugin for Eclipse IDE] ===<br />
:Eclipse is an open, extensible IDE platform for "everything and nothing in particular". It is implemented in Java and runs on several platforms. The Java IDE built on top of it has already become very popular among Java developers. The Haskell tools extend it to support editing (syntax coloring, code assist), compiling, and running Haskell programs from within the IDE. In more details, it features:<br />
:* Syntax highlighting and errors/warning highlighting<br />
:* A module browser showing all installed packages, their modules and the contents of the modules (functions, types, etc.)<br />
:* Integration with [http://www.haskell.org/hoogle/ Hoogle]: select an identifier in your code, press F4 and see the results in hoogle<br />
:* Code navigation: from within a Haskell source file, jump to the file where a symbol in declared, or everywhere a symbol is used (type sensitive search, not just a text search)<br />
:* Outline view: quickly jump to definitions in your file<br />
:* Quick fixes on common errors and import management<br />
:* A cabal file editor and integration with Cabal (uses cabal configure, cabal build under the covers), and a graphical view of installed packages<br />
:* Integration with GHCi: launch GHCi inside Eclipse on any module<br />
:* Integration with the GHCi debugger: performs the GHCi debugging commands for you from the standard Eclipse debugging interface<br />
:* Integration with [http://community.haskell.org/~ndm/hlint/ HLint]: gives you HLint warning on building and allows you to quick fix them<br />
:* Integration with [https://github.com/jaspervdj/stylish-haskell Stylish-Haskell]: format your code with stylish-haskell<br />
:* Test support: shows results of test-framework based test suite in a graphical format. HTF support to come soon.<br />
<br />
=== [http://colorer.sourceforge.net/eclipsecolorer/index.html Colorer plugin for Eclipse IDE] ===<br />
:Syntax highlighting in Eclipse can be achieved using the Colorer plugin. This is more light weight than using the EclipseFP plugin which has much functionality but can be messy to install and has sometimes been a bit shaky.<br />
<br />
:Eclipse Colorer is a plugin that enables syntax highlighting for a wide range of languages. It uses its own XML-based language for describing syntactic regions of languages. It does not include support for Haskell by default, but this can be added using the syntax description files attached below.<br />
<br />
:<b>Installation instructions</b><br />
:# Install the Colorer from the update site <code>http://colorer.sf.net/eclipsecolorer/</code> (for more detailed instructions see the project page).<br />
:# Download the Haskell syntax description files in [http://www.haskell.org/wikiupload/1/16/Haskell_Eclipse_Colorer.tar.gz Haskell_Eclipse_Colorer.tar.gz].<br />
:#Extract its contents (haskell.hrc and proto.hrc) into the following directory (overwriting proto.hrc): <code>eclipse_installation_dir/plugins/net.sf.colorer_0.9.9/colorer/hrc</code> (sometimes the wiki seems to create a nesting tar file, so you might have to unpack twise).<br />
:# Finished. A restart of Eclipse might be required. .hs files should open with syntax highlighting.<br />
<br />
:<b>Tips</b><br />
:* If .hs files open with another kind of syntax highlighting check that they are associated with the Colorer Editor (Preferences -> General -> Editors -> File Associations). Or right click on them and choose Open With -> Other -> Colorer Editor.<br />
:* Sometimes the highlighting gets confused. Then it might help to press Ctrl+R and re-colour the editor.<br />
:* Use the Word Completion feature (Shift+Alt+7) as a poor man's content assist.<br />
:* Use the standard External Tools feature in Eclipse to invoke the compiler from inside the IDE.<br />
:* Use the Block selection feature (Shift+Alt+A) to insert/remove line comments on multiple lines at the same time.<br />
:* Some other useful standard Eclipse features include the Open resource command (Ctrl+Shift+R), the File search command (Ctrl+H) and the bookmarks feature (Edit -> Add bookmark). Make sure to check Include in next/prev navigation box (Windows -> Preferences -> General -> Editors -> Text Editors -> Annotations -> Bookmarks).<br />
<br />
=== [[Leksah]] ===<br />
:Leksah is an IDE for Haskell written in Haskell. Leksah is intended as a practical tool to support the Haskell development process. It is an pre-release phase with bugs and open ends but actively developed and moving quickly. Hopefully, Leksah will already be interesting, useful and fun. Leksah uses GTK+ as GUI Toolkit with the gtk2hs binding. It is platform independent and should run on any platform where GTK+, gtk2hs and GHC can be installed. I have tested it on Windows and Linux. It only supports GHC.<br />
<br />
"I found Leksah less than satisfactory on OS X Lion. I could not figure out how to reference Test.Unit in a very simple program after several hours of trying to find the right settings in Leksah, and Leksah crashes a lot. I was able to build the same program in Eclipse within a few minutes of installing Eclipse and [http://eclipsefp.github.com/ Haskell support for Eclipse]." -- Doug Ransom<br />
<br />
- is the above still relevant? I did have to read the manual, the section concerning setting up a project (including dependencies), as leksah requires you to, but did not notice any issues, described above. Stability does not seem to be an issue either. -- Vladimir Lopatin.<br />
<br />
=== [http://www.haskell.org/haskellwiki/HIDE hIDE] ===<br />
:hIDE is a GUI-based Haskell IDE written using gtk+hs. It does not include an editor but instead interfaces with NEdit, vim or GNU emacs.<br />
<br />
=== [http://www.haskell.org/haskellwiki/HIDE hIDE-2] ===<br />
:Through the dark ages many a programmer has longed for the ultimate tool. In response to this most unnerving craving, of which we ourselves have had maybe more than our fair share, the dynamic trio of #Haskellaniacs (dons, dcoutts and Lemmih) hereby announce, to the relief of the community, that a fetus has been conceived: ''hIDE - the Haskell Integrated Development Environment''. So far the unborn integrates source code recognition and a chameleon editor, resenting these in a snappy gtk2 environment. Although no seer has yet predicted the date of birth of our hIDEous creature, we hope that the mere knowledge of its existence will spread peace of mind throughout the community as oil on troubled waters. See also: [[HIDE/Screenshots of HIDE]] and [[HIDE]]<br />
<br />
=== [http://web.archive.org/web/20060213161530/http://www.students.cs.uu.nl/people/rjchaaft/JCreator/ JCreator with Haskell support] ===<br />
: <b>N.B. The link above is to the Wayback Machine (Web Archive); it seem that JCreator is no longer supported.</b><br />
:JCreator is a highly customizable Java IDE for Windows. Features include extensive project support, fully customizable toolbars (including the images of user tools) and menus, increase/decrease indent for a selected block of text (tab/shift+tab respectively). The Haskell support module adds syntax highlighting for Haskell files and WinHugs, hugs, a static checker (if you double click on the error message, JCreator will jump to the right file and line and highlight it yellow) and the Haskell 98 Report as tools. Platforms: Win95, Win98, WinNT and Win2000 (only Win95 not tested yet). Size: 6MB. JCreator is a trademark of Xinox Software; Copyright &copy; 2000 Xinox Software. The Haskell support module is made by Rijk-Jan van Haaften.<br />
<br />
=== [http://kdevelop.org/ KDevelop] ===<br />
:This IDE supports many languages. For Haskell it currently supports project management, syntax highlighting, building (with GHC) & executing within the IDE.<br />
<br />
=== [[haste]] - Haskell TurboEdit ===<br />
:haste - Haskell TurboEdit - was an IDE for the functional programming language Haskell, written in Haskell.<br />
<br />
=== [http://www.cs.kent.ac.uk/projects/vital/ Vital] ===<br />
:Vital is a visual programming environment. It is particularly intended for supporting the open-ended, incremental style of development often preferred by end users (engineers, scientists, analysts, etc.).<br />
<br />
=== [http://www.cs.kent.ac.uk/projects/pivotal/ Pivotal] ===<br />
:Pivotal 0.025 is an early prototype of a Vital-like environment for Haskell. Unlike Vital, however, Pivotal is implemented entirely in Haskell. The implementation is based on the use of the hs-plugins library to allow dynamic compilation and evaluation of Haskell expressions together with the gtk2hs library for implementing the GUI.<br />
<br />
=== [http://www.vim.org Vim] ===<br />
<br />
This may or may not be up to date. A Vim user should update it.<br />
<br />
:* [http://projects.haskell.org/haskellmode-vim/ Haskell mode for Vim by Claus Reinke] - These plugins provide Vim integration with GHC and Haddock.<br />
:* [https://github.com/scrooloose/syntastic Syntastic] -- An extremely useful Vim plugin which will interact with ghc_mod (when editing a Haskell file) every time the source file is saved to check for syntax and type errors.<br />
:* [http://www.vim.org/scripts/script.php?script_id=2356 SHIM by Lars Kotthoff] -- Superior Haskell Interaction Mode (SHIM) plugin for Vim providing full GHCi integration (requires Vim compiled with Ruby support).<br />
:* [http://www.vim.org/scripts/script.php?script_id=3200 Haskell Conceal] -- shows Unicode symbols for common Haskell operators such as ++ and other lexical notation in Vim window (source file itself remains unchanged).<br />
:* [http://urchin.earth.li/~ian/vim/ by Ian Lynagh]: distinguishes different literal Haskell styles (Vim 7.0 includes a syntax file which supersedes these plugins).<br />
:* There's a [[Literate programming/Vim|copy of lhaskell.vim]] on the Wiki.<br />
:* [https://github.com/MarcWeber/vim-addon-haskell by Marc Weber] -- Vim script-based function/module completion, cabal support, tagging by one command, context completion ( w<tab> -> where ), module outline, etc<br />
:* [http://www.vim.org/scripts/script.php?script_id=1968 Vim indenting mode for Haskell]<br />
:* [https://github.com/ujihisa/neco-ghc neco-ghc] pragma, module, function completion.<br />
:* [https://github.com/eagletmt/ghcmod-vim Ghcmod-vim]<br />
:* [https://github.com/bitc/vim-hdevtools Hdevtools] - gives type information, quicker reloading and more.<br />
:* [http://blog-mno2.csie.org/blog/2011/11/17/vim-plugins-for-haskell-programmers/ Addition list] with some missing here with screen shots of many of the above.<br />
<br />
=== [http://www.gnu.org/s/emacs/ Emacs] ===<br />
<br />
See [[Emacs]].<br />
<br />
=== Other IDEs ===<br />
<br />
The list below is incomplete. Please add to it with whatever you think of. This list should be expanded into sections, as above, with more details, with links to the actual documentation of the described features.<br />
<br />
* Vim — '''PROS:''' Free. Works on Windows. Works in terminal. Decent alignment support. Tag-based completion and jumps. Very good syntax highlighting, flymake (via Syntastic), Cabal integration, Hoogle. Documentation for symbol at point '''CONS:''' Arcane, difficult for new users. Some complain of bad indentation support.<br />
* [http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs Emacs]— '''PROS:''' Free. Works on Windows. Works in terminal. Decent alignment, indentation, syntax highlighting. Limited type information (type and info of name at point). Cabal/GHC/GHCi awareness and Haskell-aware REPL. Completion and jump-to-definition (via ETAGS). Documentation of symbol at point. Hoogle. Documentation for symbol at point. Flymake (error checking on the fly). '''CONS:''' Arcane, difficult for new users.<br />
* Sublime — '''PROS:''' Works on Windows. '''CONS:''' Poor alignment support (though [http://www.reddit.com/r/haskell/comments/ts8fi/haskell_ides_emacs_vim_and_sublime_oh_my_opinions/c4pair1 there are packages] to do indentation a little better). Proprietary.<br />
* [[Yi]] — '''PROS:''' Written in Haskell. Works in terminal. '''CONS:''' Very immature, lacking features. Problems building generally, especially on Windows.<br />
* [http://www.haskell.org/haskellwiki/Leksah Leksah] — '''PROS:''' Syntax highlighting. Understands Cabal, Module browser, dependency knowledge, documentation display inside the IDE, jump-to-definition, flymake (error checking on the fly), limited evaluation of snippets, scratch buffer. Autocompletion. Not an arcane interface a la Emacs/Vim. '''CONS:''' Doesn't have a decent REPL. Are there any other cons? — This should be moved to the section above.<br />
* [http://www.haskell.org/visualhaskell/ Visual Haskell]<br />
* [http://www.haskell.org/haskellwiki/Editors Other]<br />
* KDevelop — Decent project management.<br />
* [http://www.cs.kent.ac.uk/projects/heat/ HEAT:] An Interactive Development Environment for Learning & Teaching Haskell<br />
* [http://www.geany.org/ Geany] '''PROS:''' Free. Works on Windows. Syntax highlighting, REPL. '''CONS:''' After using it for a while, Geany freezes quite often.<br />
<br />
== Cloud ==<br />
<br />
=== [https://www.fpcomplete.com/business/haskell-center/overview/ FP Haskell Center] ===<br />
<br />
FP Complete has developed a commercial Haskell IDE.<br />
<br />
It's in the cloud, and comes with all of the libraries on Stackage ready to go. (Basically, the Haskell Platform on steroids.)<br />
<br />
It's "in the cloud," which has its pros and cons. The editor is entirely in your browser, and has integration with Github. One particularly cool feature is that you can spin up temporary web servers to test out the Haskell-powered website you might be coding up. It's really easy, and you can pay for FP Complete to host your permanent application, too.<br />
<br />
There's a free trial, with free academic licenses and paid commercial licenses. According to a recent email from FP Complete, there will be "personal" licenses in a few weeks as well, since the commercial pricing is a bit steep for hobbyists.<br />
<br />
== See also ==<br />
<br />
<br />
* [http://blog.johantibell.com/2011/08/results-from-state-of-haskell-2011.html Results from the State of Haskell, 2011 Survey]. <br />
* [http://nickknowlson.com/blog/2011/09/12/haskell-survey-categorized-weaknesses/ Categorized Weaknesses from the State of Haskell 2011 Survey], which barely touched upon IDEs.<br />
* [[Editors]]<br />
* [[Applications and libraries/Program development#Editor support]]<br />
* [http://code.haskell.org/shim/ Shim]; the aim of the shim (Superior Haskell Interaction Mode) project is to provide better support for editing Haskell code in VIM and Emacs<br />
<br />
== Outdated ==<br />
<br />
* [http://web.archive.org/web/20110726153330/http://hoovy.org/HaskellXcodePlugin/ plugin for Xcode] (links to the web archive)<br />
* [[hIDE]], now apparently orphaned</div>Drb226https://wiki.haskell.org/LiftingLifting2013-08-12T22:41:22Z<p>Drb226: /* Arrow lifting */ type signature of arr was missing parens</p>
<hr />
<div>Lifting is a concept which allows you to transform a function into a corresponding function within another (usually more general) setting. <br />
<br />
== Lifting in general ==<br />
<br />
We usually start with a (covariant) [[functor]], for simplicity we will consider the Pair functor first. Haskell doesn't allow a <hask>type Pair a = (a, a)</hask> to be a functor instance, so we define our own Pair [[type]] instead.<br />
<haskell><br />
data Pair a = Pair a a deriving Show<br />
instance Functor Pair where<br />
fmap f (Pair x y) = Pair (f x) (f y)<br />
</haskell><br />
If you look at the type of <hask>fmap</hask> (<hask>Functor f => (a -> b) -> (f a -> f b)</hask>), you will notice that <hask>fmap</hask> already is a lifting operation: It transforms a function between simple types <hask>a</hask> and <hask>b</hask> into a function between pairs of these types.<br />
<haskell><br />
lift :: (a -> b) -> Pair a -> Pair b<br />
lift = fmap<br />
<br />
plus2 :: Pair Int -> Pair Int<br />
plus2 = lift (+2)<br />
-- plus2 (Pair 2 3) ---> Pair 4 5<br />
</haskell><br />
Note, however, that not all functions between <hask>Pair a</hask> and <hask>Pair b</hask> can constructed as a lifted function (e.g. <hask>\(x, _) -> (x, 0)</hask> can't).<br />
<br />
A functor can only lift functions of exactly one variable, but we want to lift other functions, too:<br />
<haskell><br />
lift0 :: a -> Pair a<br />
lift0 x = Pair x x<br />
<br />
lift2 :: (a -> b -> r) -> (Pair a -> Pair b -> Pair r)<br />
lift2 f (Pair x1 x2) (Pair y1 y2) = Pair (f x1 y1) (f x2 y2)<br />
<br />
plus :: Pair Int -> Pair Int -> Pair Int<br />
plus = lift2 (+)<br />
-- plus (Pair 1 2) (Pair 3 4) ---> Pair 4 6<br />
</haskell><br />
<br />
In a similar way, we can define lifting operations for all containers that have "a fixed size", for example for the functions from <hask>Double</hask> to any value <hask>((->) Double)</hask>, which might be thought of as values that are varying over time (given as <hask>Double</hask>). The function <hask> \t -> if t < 2.0 then 0 else 2 </hask> would then represent a value which switches at time 2.0 from 0 to 2. Using lifting, such functions can be manipulated in a very high-level way. In fact, this kind of lifting operation is already defined. <hask>Control.Monad.Reader</hask> (see [[MonadReader]]) provides a <hask>Functor</hask>, <hask>Applicative</hask>, <hask>Monad</hask>, <hask>MonadFix</hask> and <hask>MonadReader</hask> instance for the type <hask>(->) r</hask>. The <hask>liftM</hask> (see below) functions of this [[monad]] are precisely the lifting operations we are searching for.<br />
<br />
If the containers don't have fixed size, it's not always clear how to make lifting operations for them. The <hask>[]</hask> - type could be lifted using the <hask>zipWith</hask>-family of functions or using <hask>liftM</hask> from the list monad, for example.<br />
<br />
== Applicative lifting ==<br />
<br />
This should only provide a definition what lifting means (in the usual cases, not in the arrow case). It's not a suggestion for an implementation. I start with the (simplest?) basic operations <hask>zipL</hask>, which combines to containers into a single one and <hask>zeroL</hask>, which gives a standard container for ().<br />
<haskell><br />
class Functor f => Liftable f where<br />
zipL :: f a -> f b -> f (a, b)<br />
zeroL :: f ()<br />
<br />
liftL :: Liftable f => (a -> b) -> (f a -> f b)<br />
liftL = fmap<br />
<br />
liftL2 :: Liftable f => (a -> b -> c) -> (f a -> f b -> f c)<br />
liftL2 f x y = fmap (uncurry f) $ zipL x y<br />
<br />
liftL3 :: Liftable f => (a -> b -> c -> d) -> (f a -> f b -> f c -> f d)<br />
liftL3 f x y z = fmap (uncurry . uncurry $ f) $ zipL (zipL x y) z<br />
<br />
liftL0 :: Liftable f => a -> f a<br />
liftL0 x = fmap (const x) zeroL <br />
<br />
appL :: Liftable f => f (a -> b) -> f a -> f b<br />
appL = liftL2 ($)<br />
</haskell><br />
<br />
We need to postulate a few laws so that the definitions make sense. (Are they complete and/or minimal?)<br />
<haskell><br />
assoc :: ((a, b), c) -> (a, (b, c))<br />
assoc ~(~(x, y), z) = (x, (y, z))<br />
<br />
{-<br />
Identity:<br />
fmap snd $ zipL zeroL x === x<br />
fmap fst $ zipL x zeroL === x<br />
<br />
Associativity:<br />
fmap assoc $ zipL (zipL x y) $ z === zipL x $ zipL y z<br />
-}<br />
</haskell><br />
<br />
Today we have the <hask>Applicative</hask> class that provides [[Applicative functor]]s. It is equivalent to the <hask>Liftable</hask> class.<br />
<haskell><br />
pure = liftL0<br />
(<*>) = appL<br />
<br />
zeroL = pure ()<br />
zipL = liftA2 (,)<br />
</haskell><br />
<br />
In principle, <hask>Applicative</hask> should be a superclass of <hask>Monad</hask>, but chronologically <hask>Functor</hask> and <hask>Monad</hask> were before <hask>Applicative</hask>.<br />
Unfortunately, inserting <hask>Applicative</hask> between <hask>Functor</hask> and <hask>Monad</hask> in the subclass hierarchy would break a lot of existing code and thus has not been done as of today (2011). This is still true as of Jan 2013.<br />
<br />
== Monad lifting ==<br />
<br />
Lifting is often used together with [[monad]]s. The members of the <hask>liftM</hask>-family take a function and perform the corresponding computation within the monad.<br />
<haskell><br />
return :: (Monad m) => a -> m a<br />
liftM :: (Monad m) => (a1 -> r) -> m a1 -> m r<br />
liftM2 :: (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r<br />
</haskell><br />
Consider for example the list monad ([[MonadList]]). It performs a [[Non-determinism |nondeterministic calculation]], returning all possible results. <hask>liftM2</hask> just turns a deterministic function into a nondeterministic one:<br />
<haskell><br />
plus :: [Int] -> [Int] -> [Int]<br />
plus = liftM2 (+)<br />
-- plus [1,2,3] [3,6,9] ---> [4,7,10, 5,8,11, 6,9,12]<br />
-- plus [1..] [] ---> _|_ (i.e., keeps on calculating forever)<br />
-- plus [] [1..] ---> []<br />
</haskell><br />
<br />
Every <hask>Monad</hask> can be made an instance of <hask>Liftable</hask> using the following implementations:<br />
<haskell><br />
{-# OPTIONS -fglasgow-exts #-}<br />
{-# LANGUAGE AllowUndecidableInstances #-}<br />
import Control.Monad<br />
<br />
instance (Functor m, Monad m) => Liftable m where <br />
zipL = liftM2 (\x y -> (x,y))<br />
zeroL = return ()<br />
</haskell><br />
<br />
Lifting becomes especially interesting when there are more levels you can lift between. <hask>Control.Monad.Trans</hask> (see [[Monad transformer]]s) defines a class<br />
<haskell><br />
class MonadTrans t where<br />
lift :: Monad m => m a -> t m a -- lifts a value from the inner monad m to the transformed monad t m<br />
-- could be called lift0<br />
</haskell><br />
lift takes the side effects of a monadic computation within the inner monad <hask>m</hask> and lifts them into the transformed monad <hask>t m</hask>. We can easily define functions which lift functions between inner monads to functions between transformed monads. Then we can perform three different lifting operations:<br />
<hask>liftM</hask> can be used both to transform a pure function into a function between inner monads and to a function between transformed monads, and finally lift transforms from the inner monad to the transformed monad. Because of the purity of Haskell, we can only lift "up".<br />
<br />
== Arrow lifting ==<br />
<br />
Until now, we have only considered lifting from functions to other functions. John Hughes' arrows (see [[Understanding arrows]]) are a generalization of computation that aren't functions anymore. An arrow <hask>a b c</hask> stands for a computation which transforms values of type <hask>b</hask> to values of type <hask>c</hask>. The basic primitive <hask>arr</hask>, aka <hask>pure</hask>,<br />
<haskell><br />
arr :: (Arrow a) => (b -> c) -> a b c<br />
</haskell><br />
is also a lifting operation.<br />
<br />
[[Category:Idioms]]</div>Drb226https://wiki.haskell.org/BayHac2013BayHac20132013-03-13T18:49:24Z<p>Drb226: /* Attendees */ +Dan Burton</p>
<hr />
<div>[[Image:BayHac13_banner.png]]<br />
<br />
<b><span style="color:#e73">San Francisco Bay Area</span> <span style="color:#aaa">&amp;</span> <span style="color:#930">Silicon Valley</span> <span style="color:#aaa">Haskell Hackathon</span></b><br />
<br />
Come join a group of Haskell hackers to work on a wide variety of projects. All levels welcome.<br />
<br />
----<br />
{|<br />
|When:<br />
|Friday, May 17th – Sunday, May 19th, 2013<br />
|-<br />
|Hours:<br />
|10am ~ 7pm (still in early planning stages)<br />
|-<br />
|Where:<br />
|[http://www.hackerdojo.com/ Hacker Dojo] ''- note the Dojo has moved''<br />
|-<br />
|Cost:<br />
|Free<br />
|-<br />
|Sign up:<br />
|[https://docs.google.com/forms/d/1u502QHmyFC_Wi4fqv_jYTTRun8E6D_gwcbf6bB3dvrs/viewform sign-up form]<br />
|-<br />
|News and Discussion:<br />
|[http://groups.google.com/group/bayhac BayHac Google Group]<br />
|}<br />
<br />
== Location ==<br />
<br />
[http://www.hackerdojo.com/ Hacker Dojo], 599 Fairchild Drive, Mountain View, CA ([https://maps.google.com/maps?ie=UTF8&cid=11488539903009648209&q=Hacker+Dojo&iwloc=A&gl=US&hl=en-US Google Map])<br />
<br />
== Attendees == <br />
<br />
If you're attending, please use the [https://docs.google.com/forms/d/1u502QHmyFC_Wi4fqv_jYTTRun8E6D_gwcbf6bB3dvrs/viewform sign-up form] to help the organizers plan. Add your name here if you want to let others know you're coming.<br />
<br />
# [http://www.ozonehouse.com/mark/ Mark Lentczner] - organizer<br />
# [http://www.johantibell.com/mark/ Johan Tibell] - organizer<br />
# [http://www.linkedin.com/pub/david-banas/1/6ab/a48 David Banas] - ''AMITool'' project lead<br />
# [http://www.linkedin.com/in/danburtonhaskeller/ Dan Burton] - Just another Haskeller<br />
<br />
== Projects ==<br />
<br />
If you plan working on a project at the Hackathon, you can put it up here so other interested hackers can see what projects are afoot. If you don't have a project, look here and find one!<br />
<br />
# [http://code.google.com/p/plush/ Plush] - Mark L.<br />
# [http://www.haskell.org/haskellwiki/AMI_Tool AMITool] - David Banas<br />
[[Category:Community]]</div>Drb226https://wiki.haskell.org/List_of_partial_functionsList of partial functions2012-10-11T17:10:52Z<p>Drb226: New page: ==Partial functions in Prelude== ===List functions=== * maximum * minimum * ... (todo) ===Other=== * read * ... (todo) ==Partial functions in other base libraries== ... (todo) ==Par...</p>
<hr />
<div>==Partial functions in Prelude==<br />
<br />
===List functions===<br />
<br />
* maximum<br />
* minimum<br />
* ... (todo)<br />
<br />
===Other===<br />
<br />
* read<br />
* ... (todo)<br />
<br />
==Partial functions in other base libraries==<br />
<br />
... (todo)<br />
<br />
==Partial functions in other Haskell Platform packages==<br />
<br />
... (todo)</div>Drb226https://wiki.haskell.org/Monad_tutorials_timelineMonad tutorials timeline2012-04-22T15:16:22Z<p>Drb226: /* year 2012 */ Less Traveled Monad Tutorial and Why Do Monads Matter?</p>
<hr />
<div>[[Category:History]]<br />
[[Category:Monad]]<br />
[[Category:Tutorials]]<br />
<br />
<span style="float:right">[[Image:Monad-tutorials-chart.png]]</span><br />
<br />
This timeline covers not just monad tutorials, but interesting events in monad tutorial history. Please update this list! Don't worry about getting dates, authors, blurbs unless you really want to. We can fix it later.<br />
<br />
Older tutorials are especially interesting.<br />
<br />
The existence of this page also indicates that a observation made by [http://bartoszmilewski.wordpress.com/2011/01/09/monads-for-the-curious-programmer-part-1/ one of the tutorial authors] is actually correct:<br />
<br />
<blockquote><br />
<p>''[I]t seems like every programmer who ''gets'' monads posts a tutorial about them. (And each post begins with: There’s already a lot of monad tutorials on the Internet, but...) The reason is that ''getting'' monads it’s like a spiritual experience that you want to share with others.'' (Bartosz Milewski)</p><br />
</blockquote><br />
<br />
== before 2000 ==<br />
<br />
* 1992-08 [http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf Monads for Functional Programming] - Phil Wadler<br />
*: "Shall I be pure or impure?" One of the earliest papers on monads by the man hiself. Has been called the "''ne plus ultra'' of approachable, useful introductions to monads". It's pretty hefty (31 pages), which is a good thing!<br />
* 1995 [http://www-fp.dcs.st-and.ac.uk/~kh/papers/io-tutorial/io-tutorial.html Monadic IO in Haskell 1.3], Andrew D. Gordon and Kevin Hammond.<br />
* 1999-02 [http://www-users.mat.uni.torun.pl/~fly/materialy/fp/haskell-doc/Monads.html What the hell are Monads?] Noel Winstanley<br />
*: Written when 'what is a monad' started becoming an FAQ. Very short and sweet, advertised as more examples than theory. "Once upon a time, people wrote their Haskell programs by sequencing together operations in an ad-hoc way."<br />
* 1999-Spring [http://www.engr.mun.ca/~theo/Misc/haskell_and_monads.htm Monads for the working Haskell Programmer] - Theodore S. Norvell<br />
*: One of the original tutorials, originally written for Gofer and eventually "updated for Haskell98"<br />
<br />
== year 2002 ==<br />
<br />
* 2002 [http://en.wikibooks.org/wiki/Haskell/YAHT Yet Another Haskell Tutorial] - Hal Daumé III<br />
*: The most recommended Haskell tutorial ever. Not a monad tutorial per se, but it does address the topic<br />
<br />
== year 2003 ==<br />
<br />
* 2003-08 [http://www.haskell.org/haskellwiki/All_About_Monads All about Monads] - Jeff Newbern<br />
*: A comprehensive introduction to monads, covering also "advanced" topics like monad transformers and use of some common monads. There is an appendix which presents monads as assembly lines.<br />
<br />
== year 2004 ==<br />
<br />
* 2004-07 [http://www.ccs.neu.edu/home/dherman/research/tutorials/monads-for-schemers.txt A Schemer's Introduction to Monads]<br />
*: "This will be an introduction to monads from a Lisp/Scheme perspective, with the assumption that the reader is comfortable with continuations, CPS, accumulators, and accumulator-passing style."<br />
* 2004-07 [[Monads as Containers]] - Cale Gibbard<br />
*: Presents monads as boxes. Uses <hask>fmap</hask> and <hask>join</hask>. "If you will give me a blueberry for each apple I give you <hask>(a -> b)</hask>, and I have a box of apples <hask>(f a)</hask>, then I can get a box of blueberries <hask>(f b)</hask>."<br />
* 2004-08 [http://sleepingsquirrel.org/monads/monads.html Monads in Perl] - Greg Buchholz<br />
*: Written in the spirit of TMTOWTDI<br />
<br />
== year 2005 ==<br />
<br />
* 2005-07 [http://moonbase.rydia.net/mental/writings/programming/monads-in-ruby/00introduction.html Monads in Ruby] - MenTaLguY<br />
*: Presents monads in a friendly language, starting from Identity and building on up<br />
* 2005-11 [http://www.loria.fr/~kow/monads Of monads and space suits] - Eric Kow<br />
*: Functions are space stations, parameters are astronauts and monads are space suits that let us safely travel from one function to another.<br />
<br />
== year 2006 ==<br />
<br />
* 2006-03 [http://en.wikibooks.org/w/index.php?title=Haskell/Understanding_monads&oldid=933545 Understanding Monads] - Eric Kow<br />
*: Monads as nuclear waste containers, an adaptation of monads as space suits with a new metaphor suggested by Paul Johnson<br />
* 2006-07 [[The Monadic Way]] - Andrea Rossato<br />
*: A two-part tutorial. The first part shows you how build a simple evaluator, and the second part shows you how to "take the complexity" out of it by using techniques such as monad transformers<br />
* 2006-08 [http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads-and.html You could have invented monads! (and maybe you already have)] - Dan Piponi<br />
*: "Writing introductions to monads seems to have developed into an industry," Dan (sigfpe) observes. He argues that monads are not "something esoteric in need of explanation", but walks you through the process of reinventing monads to solve some very basic and practical problems.<br />
* 2006-09 [[Meet Bob The Monadic Lover]] - Andrea Rossato<br />
*: Bob embarks upon a series of romantic conquests... bind bind bind, Paula, Luisa, Antonia<br />
* 2006-10 [http://www.grabmueller.de/martin/www/pub/Transformers.en.html Monad Transformers Step by Step] - Martin Grabmüller<br />
** Monad transformers are rarely covered in introductory tutorials. This "is not a paper about implementing transformers, but about using them to write elegant, clean and powerful programs in Haskell". Available as a 12 page PDF or .lhs file.<br />
* 2006-11 [http://www.haskell.org/pipermail/haskell-cafe/2006-November/019190.html There's a Monster in my Haskell!] Andrew Pimlott<br />
*: This delightful "tutorial" presents monads as monsters which devour values, use them to feed other monsters and regurgitate them when slain.<br />
* 2006-12 [http://blog.tmorris.net/maybe-monad-in-java/ Maybe Monad in Java] - Tony Morris<br />
*: Monads can also be useful in Java!<br />
<br />
== year 2007 ==<br />
<br />
* 2007-01 [http://koweycode.blogspot.com/2007/01/think-of-monad.html Think of a monad] - Don Stewart (reposted on Eric Kow's blog)<br />
*: Don integrates some pre-existing monadic metaphors, shedding light on monads in a truly comprehensive manner (illustration by Eric)<br />
* 2007-02 [http://kawagner.blogspot.com/2007/02/understanding-monads-for-real.html Understanding Monads. For Real] - Karsten Wagner<br />
*: A monad is like a macro<br />
* 2007-02 [http://patryshev.com/monad/m-intro.html Crash Course in Monads] Monads for Mathematicians<br />
*:Author's Description: This crash course starts with an EASY! introduction to categories and functors, then we define a monad, then give some basic examples of monads in categories, then present monadic terminology as used in programming languages.<br />
*: Then I lie down in a dark room with a warm wet cloth over my eyes.<br />
* 2007-04 [http://saxophone.jpberlin.de/MonadTransformer?source=http%3A%2F%2Fwww%2Ehaskell%2Eorg%2Fhaskellwiki%2FCategory%3AMonad&language=English The Real Monad Transformer] - Henning Thielemann<br />
*: Not a tutorial either, but an important aid in demystifying monads<br />
* 2007-03 [http://www.randomhacks.net/articles/2007/03/12/monads-in-15-minutes Monads in 15 Minutes] - Eric Kidd<br />
*: Eric boils monads down to 15 minutes, using backtracking and Maybe as motivating examples. Eric uses <hask>join</hask>, which seems quite rare for monad tutorials (cf Cale's ''Monads as containers'')<br />
* 2007-07 [http://ahamsandwich.wordpress.com/2007/07/26/monads-and-why-monad-tutorials-are-all-awful/ Monads! (and why monad tutorials are all awful)] - Colin Gordon?<br />
*: Csgordon reports that monad tutorials tend to "get horribly botched" and says "[they] either bored me to tears, struck me as completely inane, or simply confused me". He uncovers the early Phil Wadler's paper, ''Monads for Functional Programming'', which not only gives a clear explanation but provides ''non-trivial'' motivating examples<br />
* 2007-08 [[Monads as computation]] - Cale Gibbard<br />
*: A very straightforward presentation of monads. Notable for its "The whole point" section, which conveys why we bother with all this monad business.<br />
* 2007-08 [http://en.wikibooks.org/wiki/Haskell/Understanding%20monads Understanding Monads] (2) - Apfelmus<br />
*: Wikibook rewrite of the original monads tutorial. Less fluff, more pedagogy. [In progress at the time of this writing].<br />
* 2007-08 [[Monad (sans metaphors)]] - Claus Reinke<br />
*: From a discussion about monad tutorials on Haskell Café (the name is due to haskellwiki user 'Green tea').<br />
<br />
== year 2008 ==<br />
* 2008-06 [http://spbhug.folding-maps.org/wiki/Monads Monads] (in Russian) and [http://spbhug.folding-maps.org/wiki/MonadsEn Monads] (in English) - Yet another monad tutorial, by Eugene Kirpichov; fairly advanced but skips monad transformers. Oriented towards a broader understanding of monads than just IO and Maybe.<br />
* [http://book.realworldhaskell.org/read/monads.html Monads], Chapter 14 of "Real World Haskell".<br />
<br />
== year 2009 ==<br />
* 2009-01 [http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/ Abstraction, intuition, and the “monad tutorial fallacy”] Not a monad tutorial itself, but a comment on monad tutorials and why many of them are so unhelpful.<br />
<br />
* 2009-03 [http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/ A Monad Tutorial for Clojure Programmers] An interesting perspective on monads .<br />
<br />
* 2009-11 [[What a Monad is not]] A desperate attempt to end the eternal chain of monad tutorials<br />
<br />
== year 2010 ==<br />
* 2010-07 [https://intoverflow.wordpress.com/2010/07/20/i-come-from-java-and-want-to-know-what-monads-are-in-haskell/ I come from Java and want to know what monads are in Haskell] - Tim Carstens<br />
*: An example showing how a simple Java class is translated into a stack of monad transformers, with a metaphor about how monads are like conversations, and why this idea should be familiar to OO programmers.<br />
<br />
* 2010-08 [http://learnyouahaskell.com/a-fistful-of-monads A Fistful of Monads] from Learn You a Haskell<br />
*: An introduction to monads that builds on applicative functors<br />
<br />
* 2010-08 [http://mvanier.livejournal.com/3917.html Yet Another Monad Tutorial]<br />
*: An ongoing sequence of extremely detailed tutorials deriving monads from first principles.<br />
<br />
== year 2011 ==<br />
* 2011-01 [http://bartoszmilewski.wordpress.com/2011/01/09/monads-for-the-curious-programmer-part-1/ Monads for the Curious Programmer: Part 1], [http://bartoszmilewski.wordpress.com/2011/03/14/monads-for-the-curious-programmer-part-2/ Part 2], [http://bartoszmilewski.wordpress.com/2011/03/17/monads-for-the-curious-programmer-part-3/ Part 3], and [http://bartoszmilewski.wordpress.com/2011/07/11/monads-in-c/ Monads in C++] - Bartosz Milewski<br />
<br />
* 2011-03 [http://scscript.blogspot.de/2011/03/monads-in-r-sapply-and-foreach.html monads in R: sapply and foreach] - Ferdinand Jamitzky<br />
<br />
* 2011-04 [http://ertes.de/articles/monads.html Understanding Haskell Monads] - Ertugrul Söylemez<br />
<br />
* 2011-10 [http://unknownparallel.com/monads.php The Dead Simple, No Chit Chat, Zero-Analogy Haskell Monad Tutorial] - Dan Burton<br />
<br />
== year 2012 ==<br />
* 2012-02 [http://blog.g23.co/futures-monads-with-the-context-of-asynchrono Futures: Monads with the Context of Asynchronous Programming] - mr23<br />
* 2012-02 [http://the-27th-comrade.appspot.com/blog/ahJzfnRoZS0yN3RoLWNvbXJhZGVyDAsSBUVudHJ5GOFdDA The Day Python Embarassed Imperative Programming] - The 27th Comrade<br />
* 2012-02 [http://youtu.be/Mw_Jnn_Y5iA Scala Monads] - Dan Rosen, Marakana<br />
* 2012-04 [http://softwaresimply.blogspot.com/2012/04/less-travelled-monad-tutorial-part-1.html The Less Travelled Monad Tutorial] - mightybyte<br />
* 2012-04 [http://cdsmith.wordpress.com/2012/04/18/why-do-monads-matter/ Why Do Monads Matter?] - Chris Smith</div>Drb226https://wiki.haskell.org/Monad_tutorials_timelineMonad tutorials timeline2012-03-01T16:57:51Z<p>Drb226: /* year 2011 */ +2012</p>
<hr />
<div>[[Category:History]]<br />
[[Category:Monad]]<br />
[[Category:Tutorials]]<br />
<br />
<span style="float:right">[[Image:Monad-tutorials-chart.png]]</span><br />
<br />
This timeline covers not just monad tutorials, but interesting events in monad tutorial history. Please update this list! Don't worry about getting dates, authors, blurbs unless you really want to. We can fix it later.<br />
<br />
Older tutorials are especially interesting.<br />
<br />
The existence of this page also indicates that a observation made by [http://bartoszmilewski.wordpress.com/2011/01/09/monads-for-the-curious-programmer-part-1/ one of the tutorial authors] is actually correct:<br />
<br />
<blockquote><br />
<p>''[I]t seems like every programmer who ''gets'' monads posts a tutorial about them. (And each post begins with: There’s already a lot of monad tutorials on the Internet, but...) The reason is that ''getting'' monads it’s like a spiritual experience that you want to share with others.'' (Bartosz Milewski)</p><br />
</blockquote><br />
<br />
== before 2000 ==<br />
<br />
* 1992-08 [http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf Monads for Functional Programming] - Phil Wadler<br />
*: "Shall I be pure or impure?" One of the earliest papers on monads by the man hiself. Has been called the "''ne plus ultra'' of approachable, useful introductions to monads". It's pretty hefty (31 pages), which is a good thing!<br />
* 1995 [http://www-fp.dcs.st-and.ac.uk/~kh/papers/io-tutorial/io-tutorial.html Monadic IO in Haskell 1.3], Andrew D. Gordon and Kevin Hammond.<br />
* 1999-02 [http://www-users.mat.uni.torun.pl/~fly/materialy/fp/haskell-doc/Monads.html What the hell are Monads?] Noel Winstanley<br />
*: Written when 'what is a monad' started becoming an FAQ. Very short and sweet, advertised as more examples than theory. "Once upon a time, people wrote their Haskell programs by sequencing together operations in an ad-hoc way."<br />
* 1999-Spring [http://www.engr.mun.ca/~theo/Misc/haskell_and_monads.htm Monads for the working Haskell Programmer] - Theodore S. Norvell<br />
*: One of the original tutorials, originally written for Gofer and eventually "updated for Haskell98"<br />
<br />
== year 2002 ==<br />
<br />
* 2002 [http://en.wikibooks.org/wiki/Haskell/YAHT Yet Another Haskell Tutorial] - Hal Daumé III<br />
*: The most recommended Haskell tutorial ever. Not a monad tutorial per se, but it does address the topic<br />
<br />
== year 2003 ==<br />
<br />
* 2003-08 [http://www.haskell.org/haskellwiki/All_About_Monads All about Monads] - Jeff Newbern<br />
*: A comprehensive introduction to monads, covering also "advanced" topics like monad transformers and use of some common monads. There is an appendix which presents monads as assembly lines.<br />
<br />
== year 2004 ==<br />
<br />
* 2004-07 [http://www.ccs.neu.edu/home/dherman/research/tutorials/monads-for-schemers.txt A Schemer's Introduction to Monads]<br />
*: "This will be an introduction to monads from a Lisp/Scheme perspective, with the assumption that the reader is comfortable with continuations, CPS, accumulators, and accumulator-passing style."<br />
* 2004-07 [[Monads as Containers]] - Cale Gibbard<br />
*: Presents monads as boxes. Uses <hask>fmap</hask> and <hask>join</hask>. "If you will give me a blueberry for each apple I give you <hask>(a -> b)</hask>, and I have a box of apples <hask>(f a)</hask>, then I can get a box of blueberries <hask>(f b)</hask>."<br />
* 2004-08 [http://sleepingsquirrel.org/monads/monads.html Monads in Perl] - Greg Buchholz<br />
*: Written in the spirit of TMTOWTDI<br />
<br />
== year 2005 ==<br />
<br />
* 2005-07 [http://moonbase.rydia.net/mental/writings/programming/monads-in-ruby/00introduction.html Monads in Ruby] - MenTaLguY<br />
*: Presents monads in a friendly language, starting from Identity and building on up<br />
* 2005-11 [http://www.loria.fr/~kow/monads Of monads and space suits] - Eric Kow<br />
*: Functions are space stations, parameters are astronauts and monads are space suits that let us safely travel from one function to another.<br />
<br />
== year 2006 ==<br />
<br />
* 2006-03 [http://en.wikibooks.org/w/index.php?title=Haskell/Understanding_monads&oldid=933545 Understanding Monads] - Eric Kow<br />
*: Monads as nuclear waste containers, an adaptation of monads as space suits with a new metaphor suggested by Paul Johnson<br />
* 2006-07 [[The Monadic Way]] - Andrea Rossato<br />
*: A two-part tutorial. The first part shows you how build a simple evaluator, and the second part shows you how to "take the complexity" out of it by using techniques such as monad transformers<br />
* 2006-08 [http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads-and.html You could have invented monads! (and maybe you already have)] - Dan Piponi<br />
*: "Writing introductions to monads seems to have developed into an industry," Dan (sigfpe) observes. He argues that monads are not "something esoteric in need of explanation", but walks you through the process of reinventing monads to solve some very basic and practical problems.<br />
* 2006-09 [[Meet Bob The Monadic Lover]] - Andrea Rossato<br />
*: Bob embarks upon a series of romantic conquests... bind bind bind, Paula, Luisa, Antonia<br />
* 2006-10 [http://www.grabmueller.de/martin/www/pub/Transformers.en.html Monad Transformers Step by Step] - Martin Grabmüller<br />
** Monad transformers are rarely covered in introductory tutorials. This "is not a paper about implementing transformers, but about using them to write elegant, clean and powerful programs in Haskell". Available as a 12 page PDF or .lhs file.<br />
* 2006-11 [http://www.haskell.org/pipermail/haskell-cafe/2006-November/019190.html There's a Monster in my Haskell!] Andrew Pimlott<br />
*: This delightful "tutorial" presents monads as monsters which devour values, use them to feed other monsters and regurgitate them when slain.<br />
* 2006-12 [http://blog.tmorris.net/maybe-monad-in-java/ Maybe Monad in Java] - Tony Morris<br />
*: Monads can also be useful in Java!<br />
<br />
== year 2007 ==<br />
<br />
* 2007-01 [http://koweycode.blogspot.com/2007/01/think-of-monad.html Think of a monad] - Don Stewart (reposted on Eric Kow's blog)<br />
*: Don integrates some pre-existing monadic metaphors, shedding light on monads in a truly comprehensive manner (illustration by Eric)<br />
* 2007-02 [http://kawagner.blogspot.com/2007/02/understanding-monads-for-real.html Understanding Monads. For Real] - Karsten Wagner<br />
*: A monad is like a macro<br />
* 2007-02 [http://patryshev.com/monad/m-intro.html Crash Course in Monads] Monads for Mathematicians<br />
*:Author's Description: This crash course starts with an EASY! introduction to categories and functors, then we define a monad, then give some basic examples of monads in categories, then present monadic terminology as used in programming languages.<br />
*: Then I lie down in a dark room with a warm wet cloth over my eyes.<br />
* 2007-04 [http://saxophone.jpberlin.de/MonadTransformer?source=http%3A%2F%2Fwww%2Ehaskell%2Eorg%2Fhaskellwiki%2FCategory%3AMonad&language=English The Real Monad Transformer] - Henning Thielemann<br />
*: Not a tutorial either, but an important aid in demystifying monads<br />
* 2007-03 [http://www.randomhacks.net/articles/2007/03/12/monads-in-15-minutes Monads in 15 Minutes] - Eric Kidd<br />
*: Eric boils monads down to 15 minutes, using backtracking and Maybe as motivating examples. Eric uses <hask>join</hask>, which seems quite rare for monad tutorials (cf Cale's ''Monads as containers'')<br />
* 2007-07 [http://ahamsandwich.wordpress.com/2007/07/26/monads-and-why-monad-tutorials-are-all-awful/ Monads! (and why monad tutorials are all awful)] - Colin Gordon?<br />
*: Csgordon reports that monad tutorials tend to "get horribly botched" and says "[they] either bored me to tears, struck me as completely inane, or simply confused me". He uncovers the early Phil Wadler's paper, ''Monads for Functional Programming'', which not only gives a clear explanation but provides ''non-trivial'' motivating examples<br />
* 2007-08 [[Monads as computation]] - Cale Gibbard<br />
*: A very straightforward presentation of monads. Notable for its "The whole point" section, which conveys why we bother with all this monad business.<br />
* 2007-08 [http://en.wikibooks.org/wiki/Haskell/Understanding%20monads Understanding Monads] (2) - Apfelmus<br />
*: Wikibook rewrite of the original monads tutorial. Less fluff, more pedagogy. [In progress at the time of this writing].<br />
* 2007-08 [[Monad (sans metaphors)]] - Claus Reinke<br />
*: From a discussion about monad tutorials on Haskell Café (the name is due to haskellwiki user 'Green tea').<br />
<br />
== year 2008 ==<br />
* 2008-06 [http://spbhug.folding-maps.org/wiki/Monads Monads] (in Russian) and [http://spbhug.folding-maps.org/wiki/MonadsEn Monads] (in English) - Yet another monad tutorial, by Eugene Kirpichov; fairly advanced but skips monad transformers. Oriented towards a broader understanding of monads than just IO and Maybe.<br />
* [http://book.realworldhaskell.org/read/monads.html Monads], Chapter 14 of "Real World Haskell".<br />
<br />
== year 2009 ==<br />
* 2009-01 [http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/ Abstraction, intuition, and the “monad tutorial fallacy”] Not a monad tutorial itself, but a comment on monad tutorials and why many of them are so unhelpful.<br />
<br />
* 2009-03 [http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/ A Monad Tutorial for Clojure Programmers] An interesting perspective on monads .<br />
<br />
* 2009-11 [[What a Monad is not]] A desperate attempt to end the eternal chain of monad tutorials<br />
<br />
== year 2010 ==<br />
* 2010-07 [https://intoverflow.wordpress.com/2010/07/20/i-come-from-java-and-want-to-know-what-monads-are-in-haskell/ I come from Java and want to know what monads are in Haskell] - Tim Carstens<br />
*: An example showing how a simple Java class is translated into a stack of monad transformers, with a metaphor about how monads are like conversations, and why this idea should be familiar to OO programmers.<br />
<br />
* 2010-08 [http://learnyouahaskell.com/a-fistful-of-monads A Fistful of Monads] from Learn You a Haskell<br />
*: An introduction to monads that builds on applicative functors<br />
<br />
* 2010-08 [http://mvanier.livejournal.com/3917.html Yet Another Monad Tutorial]<br />
*: An ongoing sequence of extremely detailed tutorials deriving monads from first principles.<br />
<br />
== year 2011 ==<br />
* 2011-01 [http://bartoszmilewski.wordpress.com/2011/01/09/monads-for-the-curious-programmer-part-1/ Monads for the Curious Programmer: Part 1], [http://bartoszmilewski.wordpress.com/2011/03/14/monads-for-the-curious-programmer-part-2/ Part 2], [http://bartoszmilewski.wordpress.com/2011/03/17/monads-for-the-curious-programmer-part-3/ Part 3], and [http://bartoszmilewski.wordpress.com/2011/07/11/monads-in-c/ Monads in C++] - Bartosz Milewski<br />
<br />
* 2011-04 [http://ertes.de/articles/monads.html Understanding Haskell Monads] - Ertugrul Söylemez<br />
<br />
* 2011-10 [http://unknownparallel.com/monads.php The Dead Simple, No Chit Chat, Zero-Analogy Haskell Monad Tutorial] - Dan Burton<br />
<br />
== year 2012 ==<br />
* 2012-02 [http://blog.g23.co/futures-monads-with-the-context-of-asynchrono Futures: Monads with the Context of Asynchronous Programming] - mr23<br />
* 2012-02 [http://the-27th-comrade.appspot.com/blog/ahJzfnRoZS0yN3RoLWNvbXJhZGVyDAsSBUVudHJ5GOFdDA The Day Python Embarassed Imperative Programming] - The 27th Comrade</div>Drb226https://wiki.haskell.org/KindsKinds2012-01-28T22:22:44Z<p>Drb226: redirect to Kind</p>
<hr />
<div>#REDIRECT [[Kind]]</div>Drb226https://wiki.haskell.org/MemoizationMemoization2012-01-19T06:16:47Z<p>Drb226: /* Memoization with recursion */ the eta-expanded version doesn't actually memoize properly</p>
<hr />
<div>[[Category:Idioms]]<br />
<br />
'''Memoization''' is a technique for storing values of a function instead of recomputing them each time the function is called.<br />
<br />
== Memoization without recursion ==<br />
<br />
You can just write a memoization function using a data structure that is suitable for your application.<br />
We don't go into the details of this case.<br />
If you want a general solution for several types,<br />
you need a type class, say <hask>Memoizable</hask>.<br />
<haskell><br />
memoize :: Memoizable a => (a->b) -> (a->b)<br />
</haskell><br />
<br />
Now, how to implement something like this? Of course, one needs a finite<br />
map that stores values <hask>b</hask> for keys of type <hask>a</hask>.<br />
It turns out that such a map can be constructed recursively based on the structure of <hask>a</hask>:<br />
<haskell><br />
Map () b := b<br />
Map (Either a a') b := (Map a b, Map a' b)<br />
Map (a,a') b := Map a (Map a' b)<br />
</haskell><br />
<br />
Here, <hask>Map a b</hask> is the type of a finite map from keys <hask>a</hask> to values <hask>b</hask>.<br />
Its construction is based on the following laws for functions<br />
<haskell><br />
() -> b =~= b<br />
(a + a') -> b =~= (a -> b) x (a' -> b) -- = case analysis<br />
(a x a') -> b =~= a -> (a' -> b) -- = currying<br />
</haskell><br />
<br />
For further and detailed explanations, see<br />
<br />
* Ralf Hinze: [http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.3272 Memo functions, polytypically !]<br />
* Ralf Hinze: [http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.8.4069 Generalizing generalized tries]<br />
* Conal Elliott: [http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/ Elegant memoization with functional memo tries] and other [http://conal.net/blog/tag/memoization/ posts on memoization].<br />
* Conal Elliott [http://conal.net/papers/type-class-morphisms/ Denotational design with type class morphisms], section 9 (Memo tries).<br />
<br />
== Memoization with recursion ==<br />
<br />
Things become more complicated if the function is recursively defined<br />
and it should use memoized calls to itself.<br />
A classic example is the recursive computation of [[The Fibonacci sequence|Fibonacci numbers]].<br />
<br />
The naive implementation of Fibonacci numbers without memoization is horribly slow.<br />
Try <hask>slow_fib 30</hask>, not too much higher than that and it hangs.<br />
<haskell><br />
slow_fib :: Int -> Integer<br />
slow_fib 0 = 0<br />
slow_fib 1 = 1<br />
slow_fib n = slow_fib (n-2) + slow_fib (n-1)<br />
</haskell><br />
<br />
The memoized version is much faster.<br />
Try <hask>memoized_fib 10000</hask>.<br />
<br />
<haskell><br />
memoized_fib :: Int -> Integer<br />
memoized_fib = (map fib [0 ..] !!)<br />
where fib 0 = 0<br />
fib 1 = 1<br />
fib n = memoized_fib (n-2) + memoized_fib (n-1)<br />
</haskell><br />
<br />
<br />
=== Memoizing fix point operator ===<br />
<br />
You can factor out the memoizing trick to a function, the memoizing fix point operator,<br />
which we will call <hask>memoFix</hask> here.<br />
<br />
<haskell><br />
fib :: (Int -> Integer) -> Int -> Integer<br />
fib f 0 = 1<br />
fib f 1 = 1<br />
fib f n = f (n-1) + f (n-2)<br />
<br />
fibonacci :: Int -> Integer<br />
fibonacci = memoFix fib<br />
<br />
</haskell><br />
<br />
I suppose if you want to "put it in a library",<br />
you should just put <hask>fib</hask> in,<br />
and allow the user to call <hask>memoFix fib</hask> to make a new version when necessary.<br />
This allows the user e.g. to define the data structure used for memoization.<br />
<br />
The memoising fixpoint operator works<br />
by putting the result of the first call of the function<br />
for each natural number into a data structure and<br />
using that value for subsequent calls ;-)<br />
<br />
In general it is<br />
<haskell><br />
memoFix :: ((a -> b) -> (a -> b)) -> a -> b<br />
memoFix f =<br />
let mf = memoize (f mf) in mf<br />
</haskell><br />
<br />
== Efficient tree data structure for maps from Int to somewhere ==<br />
<br />
Here we present a special tree data type<br />
({{HackagePackage|id=data-inttrie}})<br />
which is useful as memoizing data structure e.g. for the Fibonacci function.<br />
<haskell><br />
memoizeInt :: (Int -> a) -> (Int -> a)<br />
memoizeInt f = (fmap f (naturals 1 0) !!!)<br />
</haskell><br />
<br />
A data structure with a node corresponding to each natural number to use as a memo.<br />
<haskell><br />
data NaturalTree a = Node a (NaturalTree a) (NaturalTree a)<br />
</haskell><br />
<br />
Map the nodes to the naturals in this order:<br />
<br />
<code><br />
0<br />
1 2<br />
3 5 4 6<br />
7 ...<br />
</code><br />
<br />
Look up the node for a particular number<br />
<br />
<haskell><br />
Node a tl tr !!! 0 = a <br />
Node a tl tr !!! n =<br />
if odd n<br />
then tl !!! top<br />
else tr !!! (top-1)<br />
where top = n `div` 2<br />
</haskell><br />
<br />
We surely want to be able to map on these things...<br />
<br />
<haskell><br />
instance Functor NaturalTree where<br />
fmap f (Node a tl tr) = Node (f a) (fmap f tl) (fmap f tr)<br />
</haskell><br />
<br />
If only so that we can write cute,<br />
but inefficient things like the below,<br />
which is just a <hask>NaturalTree</hask><br />
such that <hask>naturals!!!n == n</hask>:<br />
<br />
<haskell><br />
naturals = Node 0 (fmap ((+1).(*2)) naturals) (fmap ((*2).(+1)) naturals)<br />
</haskell><br />
<br />
The following is probably more efficient<br />
(and, having arguments won't hang around at top level, I think)<br />
-- have I put more <hask>$!</hask>s than necessary?<br />
<br />
<haskell><br />
naturals r n =<br />
Node n<br />
((naturals $! r2) $! (n+r))<br />
((naturals $! r2) $! (n+r2))<br />
where r2 = 2*r<br />
</haskell><br />
<br />
==Memoising CAFS==<br />
'''Note: This is migrated from the old wiki.'''<br />
<br />
Memoising constructor functions gives you HashConsing, and you can sometimes use MemoisingCafs to implement that.<br />
<br />
The MemoisingCafs idiom also supports recursion.<br />
<br />
Consider, for example:<br />
<br />
<haskell><br />
wonderous :: Integer -> Integer<br />
wonderous 1 = 0<br />
wonderous x<br />
| even x = 1 + wonderous (x `div` 2)<br />
| otherwise = 1 + wonderous (3*x+1)<br />
</haskell><br />
This function is not at all understood by mathematicians and has a surprisingly complex recursion pattern, so if you need to call it many times with different values, optimising it would not be easy.<br />
<br />
However, we can memoise some of the domain using an array CAF:<br />
<haskell><br />
wonderous2 :: Integer -> Integer<br />
wonderous2 x<br />
| x <= maxMemo = memoArray ! x<br />
| otherwise = wonderous2' x<br />
where<br />
maxMemo = 100<br />
memoArray = array (1,maxMemo)<br />
[ (x, wonderous2' x) | x <- [1..maxMemo] ]<br />
<br />
wonderous2' 1 = 0<br />
wonderous2' x<br />
| even x = 1 + wonderous2 (x `div` 2)<br />
| otherwise = 1 + wonderous2' (3*x+1)<br />
</haskell><br />
When using this pattern in your own code, note carefully when to call the memoised version (wonderous2 in the above example) and when not to. In general, the partially memoised version (wonderous2' in the above example) should call the memoised version if it needs to perform a recursive call. However, in this instance, we only memoize for small values of x, so the branch of the recursion that passes a larger argument need not bother checking the memo table. (This does slow the array initialization, however.)<br />
Thanks to [[lazy evaluation]], we can even memoise an infinite domain, though we lose constant time lookup. This data structure is O(log N):<br />
<br />
<haskell><br />
type MemoTable a = [(Integer, BinTree a)]<br />
data BinTree a = Leaf a | Node Integer (BinTree a) (BinTree a)<br />
<br />
wonderous3 :: Integer -> Integer<br />
wonderous3 x<br />
= searchMemoTable x memoTable<br />
where<br />
memoTable :: MemoTable Integer<br />
memoTable = buildMemoTable 1 5<br />
<br />
buildMemoTable n i<br />
= (nextn, buildMemoTable' n i) : buildMemoTable nextn (i+1)<br />
where<br />
nextn = n + 2^i<br />
<br />
buildMemoTable' base 0<br />
= Leaf (wonderous3' base)<br />
buildMemoTable' base i<br />
= Node (base + midSize)<br />
(buildMemoTable' base (i-1))<br />
(buildMemoTable' (base + midSize) (i-1))<br />
where<br />
midSize = 2 ^ (i-1)<br />
<br />
searchMemoTable x ((x',tree):ms)<br />
| x < x' = searchMemoTree x tree<br />
| otherwise = searchMemoTable x ms<br />
<br />
searchMemoTree x (Leaf y) = y<br />
searchMemoTree x (Node mid l r)<br />
| x < mid = searchMemoTree x l<br />
| otherwise = searchMemoTree x r<br />
<br />
wonderous3' 1 = 0<br />
wonderous3' x<br />
| even x = 1 + wonderous3 (x `div` 2)<br />
| otherwise = 1 + wonderous3 (3*x+1)<br />
</haskell><br />
<br />
Naturally, these techniques can be combined, say, by using a fast CAF data structure for the most common part of the domain and an infinite CAF data structure for the rest.<br />
<br />
-- [[AndrewBromage]]<br />
<br />
== Memoizing polymorphic functions ==<br />
<br />
What about memoizing polymorphic functions defined with polymorphic recursion?<br />
How can such functions be memoized?<br />
The caching data structures used in memoization typically handle only one type of argument at a time.<br />
For instance, one can have finite maps of differing types, but each concrete finite map holds just one type of key and one type of value.<br />
<br />
See the discussion on *Memoizing polymorphic functions*, [http://conal.net/blog/posts/memoizing-polymorphic-functions-part-one/ part one] and [http://conal.net/blog/posts/memoizing-polymorphic-functions-part-two/ part two].<br />
<br />
== See also ==<br />
<br />
* [http://www.haskell.org/pipermail/haskell-cafe/2007-February/022590.html Haskell-Cafe "speeding up fibonacci with memoizing"]<br />
* [http://www.haskell.org/pipermail/haskell-cafe/2007-May/025991.html Haskell-Cafe about memoization utility function]<br />
* [http://www.haskell.org/pipermail/haskell-cafe/2007-February/022865.html Haskell-Cafe "memoisation"]<br />
* [http://www.haskell.org/pipermail/haskell-cafe/2005-October/011589.html Haskell-Cafe about Memoization and Data.Map]<br />
* http://programming.reddit.com/info/16ofr/comments<br />
* [http://www.cs.utexas.edu/~wcook/Drafts/2006/MemoMixins.pdf Monadic Memoization Mixins] by Daniel Brown and William R. Cook<br />
* [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/data-memocombinators data-memocombinators: Combinators for building memo tables.]<br />
* [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MemoTrie MemoTrie: Trie-based memo functions]</div>Drb226https://wiki.haskell.org/MemoizationMemoization2012-01-17T22:19:43Z<p>Drb226: /* Memoization with recursion */ slight clarification for newer Haskellers</p>
<hr />
<div>[[Category:Idioms]]<br />
<br />
'''Memoization''' is a technique for storing values of a function instead of recomputing them each time the function is called.<br />
<br />
== Memoization without recursion ==<br />
<br />
You can just write a memoization function using a data structure that is suitable for your application.<br />
We don't go into the details of this case.<br />
If you want a general solution for several types,<br />
you need a type class, say <hask>Memoizable</hask>.<br />
<haskell><br />
memoize :: Memoizable a => (a->b) -> (a->b)<br />
</haskell><br />
<br />
Now, how to implement something like this? Of course, one needs a finite<br />
map that stores values <hask>b</hask> for keys of type <hask>a</hask>.<br />
It turns out that such a map can be constructed recursively based on the structure of <hask>a</hask>:<br />
<haskell><br />
Map () b := b<br />
Map (Either a a') b := (Map a b, Map a' b)<br />
Map (a,a') b := Map a (Map a' b)<br />
</haskell><br />
<br />
Here, <hask>Map a b</hask> is the type of a finite map from keys <hask>a</hask> to values <hask>b</hask>.<br />
Its construction is based on the following laws for functions<br />
<haskell><br />
() -> b =~= b<br />
(a + a') -> b =~= (a -> b) x (a' -> b) -- = case analysis<br />
(a x a') -> b =~= a -> (a' -> b) -- = currying<br />
</haskell><br />
<br />
For further and detailed explanations, see<br />
<br />
* Ralf Hinze: [http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.3272 Memo functions, polytypically !]<br />
* Ralf Hinze: [http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.8.4069 Generalizing generalized tries]<br />
* Conal Elliott: [http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/ Elegant memoization with functional memo tries] and other [http://conal.net/blog/tag/memoization/ posts on memoization].<br />
* Conal Elliott [http://conal.net/papers/type-class-morphisms/ Denotational design with type class morphisms], section 9 (Memo tries).<br />
<br />
== Memoization with recursion ==<br />
<br />
Things become more complicated if the function is recursively defined<br />
and it should use memoized calls to itself.<br />
A classic example is the recursive computation of [[The Fibonacci sequence|Fibonacci numbers]].<br />
<br />
The naive implementation of Fibonacci numbers without memoization is horribly slow.<br />
Try <hask>slow_fib 30</hask>, not too much higher than that and it hangs.<br />
<haskell><br />
slow_fib :: Int -> Integer<br />
slow_fib 0 = 0<br />
slow_fib 1 = 1<br />
slow_fib n = slow_fib (n-2) + slow_fib (n-1)<br />
</haskell><br />
<br />
The memoized version is much faster.<br />
Try <hask>memoized_fib 10000</hask>.<br />
<br />
<haskell><br />
memoized_fib :: Int -> Integer<br />
memoized_fib x = map fib [0 ..] !! x<br />
where fib 0 = 0<br />
fib 1 = 1<br />
fib n = memoized_fib (n-2) + memoized_fib (n-1)<br />
</haskell><br />
<br />
<br />
=== Memoizing fix point operator ===<br />
<br />
You can factor out the memoizing trick to a function, the memoizing fix point operator,<br />
which we will call <hask>memoFix</hask> here.<br />
<br />
<haskell><br />
fib :: (Int -> Integer) -> Int -> Integer<br />
fib f 0 = 1<br />
fib f 1 = 1<br />
fib f n = f (n-1) + f (n-2)<br />
<br />
fibonacci :: Int -> Integer<br />
fibonacci = memoFix fib<br />
<br />
</haskell><br />
<br />
I suppose if you want to "put it in a library",<br />
you should just put <hask>fib</hask> in,<br />
and allow the user to call <hask>memoFix fib</hask> to make a new version when necessary.<br />
This allows the user e.g. to define the data structure used for memoization.<br />
<br />
The memoising fixpoint operator works<br />
by putting the result of the first call of the function<br />
for each natural number into a data structure and<br />
using that value for subsequent calls ;-)<br />
<br />
In general it is<br />
<haskell><br />
memoFix :: ((a -> b) -> (a -> b)) -> a -> b<br />
memoFix f =<br />
let mf = memoize (f mf) in mf<br />
</haskell><br />
<br />
== Efficient tree data structure for maps from Int to somewhere ==<br />
<br />
Here we present a special tree data type<br />
({{HackagePackage|id=data-inttrie}})<br />
which is useful as memoizing data structure e.g. for the Fibonacci function.<br />
<haskell><br />
memoizeInt :: (Int -> a) -> (Int -> a)<br />
memoizeInt f = (fmap f (naturals 1 0) !!!)<br />
</haskell><br />
<br />
A data structure with a node corresponding to each natural number to use as a memo.<br />
<haskell><br />
data NaturalTree a = Node a (NaturalTree a) (NaturalTree a)<br />
</haskell><br />
<br />
Map the nodes to the naturals in this order:<br />
<br />
<code><br />
0<br />
1 2<br />
3 5 4 6<br />
7 ...<br />
</code><br />
<br />
Look up the node for a particular number<br />
<br />
<haskell><br />
Node a tl tr !!! 0 = a <br />
Node a tl tr !!! n =<br />
if odd n<br />
then tl !!! top<br />
else tr !!! (top-1)<br />
where top = n `div` 2<br />
</haskell><br />
<br />
We surely want to be able to map on these things...<br />
<br />
<haskell><br />
instance Functor NaturalTree where<br />
fmap f (Node a tl tr) = Node (f a) (fmap f tl) (fmap f tr)<br />
</haskell><br />
<br />
If only so that we can write cute,<br />
but inefficient things like the below,<br />
which is just a <hask>NaturalTree</hask><br />
such that <hask>naturals!!!n == n</hask>:<br />
<br />
<haskell><br />
naturals = Node 0 (fmap ((+1).(*2)) naturals) (fmap ((*2).(+1)) naturals)<br />
</haskell><br />
<br />
The following is probably more efficient<br />
(and, having arguments won't hang around at top level, I think)<br />
-- have I put more <hask>$!</hask>s than necessary?<br />
<br />
<haskell><br />
naturals r n =<br />
Node n<br />
((naturals $! r2) $! (n+r))<br />
((naturals $! r2) $! (n+r2))<br />
where r2 = 2*r<br />
</haskell><br />
<br />
==Memoising CAFS==<br />
'''Note: This is migrated from the old wiki.'''<br />
<br />
Memoising constructor functions gives you HashConsing, and you can sometimes use MemoisingCafs to implement that.<br />
<br />
The MemoisingCafs idiom also supports recursion.<br />
<br />
Consider, for example:<br />
<br />
<haskell><br />
wonderous :: Integer -> Integer<br />
wonderous 1 = 0<br />
wonderous x<br />
| even x = 1 + wonderous (x `div` 2)<br />
| otherwise = 1 + wonderous (3*x+1)<br />
</haskell><br />
This function is not at all understood by mathematicians and has a surprisingly complex recursion pattern, so if you need to call it many times with different values, optimising it would not be easy.<br />
<br />
However, we can memoise some of the domain using an array CAF:<br />
<haskell><br />
wonderous2 :: Integer -> Integer<br />
wonderous2 x<br />
| x <= maxMemo = memoArray ! x<br />
| otherwise = wonderous2' x<br />
where<br />
maxMemo = 100<br />
memoArray = array (1,maxMemo)<br />
[ (x, wonderous2' x) | x <- [1..maxMemo] ]<br />
<br />
wonderous2' 1 = 0<br />
wonderous2' x<br />
| even x = 1 + wonderous2 (x `div` 2)<br />
| otherwise = 1 + wonderous2' (3*x+1)<br />
</haskell><br />
When using this pattern in your own code, note carefully when to call the memoised version (wonderous2 in the above example) and when not to. In general, the partially memoised version (wonderous2' in the above example) should call the memoised version if it needs to perform a recursive call. However, in this instance, we only memoize for small values of x, so the branch of the recursion that passes a larger argument need not bother checking the memo table. (This does slow the array initialization, however.)<br />
Thanks to [[lazy evaluation]], we can even memoise an infinite domain, though we lose constant time lookup. This data structure is O(log N):<br />
<br />
<haskell><br />
type MemoTable a = [(Integer, BinTree a)]<br />
data BinTree a = Leaf a | Node Integer (BinTree a) (BinTree a)<br />
<br />
wonderous3 :: Integer -> Integer<br />
wonderous3 x<br />
= searchMemoTable x memoTable<br />
where<br />
memoTable :: MemoTable Integer<br />
memoTable = buildMemoTable 1 5<br />
<br />
buildMemoTable n i<br />
= (nextn, buildMemoTable' n i) : buildMemoTable nextn (i+1)<br />
where<br />
nextn = n + 2^i<br />
<br />
buildMemoTable' base 0<br />
= Leaf (wonderous3' base)<br />
buildMemoTable' base i<br />
= Node (base + midSize)<br />
(buildMemoTable' base (i-1))<br />
(buildMemoTable' (base + midSize) (i-1))<br />
where<br />
midSize = 2 ^ (i-1)<br />
<br />
searchMemoTable x ((x',tree):ms)<br />
| x < x' = searchMemoTree x tree<br />
| otherwise = searchMemoTable x ms<br />
<br />
searchMemoTree x (Leaf y) = y<br />
searchMemoTree x (Node mid l r)<br />
| x < mid = searchMemoTree x l<br />
| otherwise = searchMemoTree x r<br />
<br />
wonderous3' 1 = 0<br />
wonderous3' x<br />
| even x = 1 + wonderous3 (x `div` 2)<br />
| otherwise = 1 + wonderous3 (3*x+1)<br />
</haskell><br />
<br />
Naturally, these techniques can be combined, say, by using a fast CAF data structure for the most common part of the domain and an infinite CAF data structure for the rest.<br />
<br />
-- [[AndrewBromage]]<br />
<br />
== Memoizing polymorphic functions ==<br />
<br />
What about memoizing polymorphic functions defined with polymorphic recursion?<br />
How can such functions be memoized?<br />
The caching data structures used in memoization typically handle only one type of argument at a time.<br />
For instance, one can have finite maps of differing types, but each concrete finite map holds just one type of key and one type of value.<br />
<br />
See the discussion on *Memoizing polymorphic functions*, [http://conal.net/blog/posts/memoizing-polymorphic-functions-part-one/ part one] and [http://conal.net/blog/posts/memoizing-polymorphic-functions-part-two/ part two].<br />
<br />
== See also ==<br />
<br />
* [http://www.haskell.org/pipermail/haskell-cafe/2007-February/022590.html Haskell-Cafe "speeding up fibonacci with memoizing"]<br />
* [http://www.haskell.org/pipermail/haskell-cafe/2007-May/025991.html Haskell-Cafe about memoization utility function]<br />
* [http://www.haskell.org/pipermail/haskell-cafe/2007-February/022865.html Haskell-Cafe "memoisation"]<br />
* [http://www.haskell.org/pipermail/haskell-cafe/2005-October/011589.html Haskell-Cafe about Memoization and Data.Map]<br />
* http://programming.reddit.com/info/16ofr/comments<br />
* [http://www.cs.utexas.edu/~wcook/Drafts/2006/MemoMixins.pdf Monadic Memoization Mixins] by Daniel Brown and William R. Cook<br />
* [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/data-memocombinators data-memocombinators: Combinators for building memo tables.]<br />
* [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MemoTrie MemoTrie: Trie-based memo functions]</div>Drb226https://wiki.haskell.org/TypeclassopaediaTypeclassopaedia2012-01-11T02:15:03Z<p>Drb226: Redirecting to Typeclassopedia</p>
<hr />
<div>#REDIRECT [[Typeclassopedia]]</div>Drb226https://wiki.haskell.org/Lambdabot/BuildingLambdabot/Building2011-10-25T21:18:20Z<p>Drb226: +</p>
<hr />
<div>Unfortunately, some of the packages that [[Lambdabot]] depends on in [[Hackage]] do not, as of 9 January 2009, support [[GHC]] 6.10.<br />
Fortunately, the [[darcs]] repositories of most of these packages do support it.<br />
<br />
== To compile lambdabot on ghc >=6.10, follow the following steps ==<br />
<br />
Get the stuff from [[darcs]] repositories:<br />
<code><br />
darcs get http://code.haskell.org/HSP/haskell-src-exts<br />
darcs get http://code.haskell.org/mubot<br />
darcs get http://code.haskell.org/lambdabot<br />
</code><br />
<br />
Lets install haskell-src-exts from darcs (TODO: This may not actually be required, the one from Hackage might be good enough):<br />
<code><br />
cd haskell-src-exts<br />
cabal install<br />
cd ..<br />
</code><br />
<br />
Install mueval:<br />
<code><br />
cd mubot/mueval<br />
cabal install<br />
cd ../..<br />
</code><br />
<br />
Apply a patch to lambdabot and install it:<br />
<code><br />
cd lambdabot<br />
wget http://www.haskell.org/wikiupload/e/ed/Lambdabot.patch -O -|patch -p1<br />
cabal install<br />
cd ..<br />
</code><br />
<br />
Edit your online.rc file at ~/.cabal/share/lambdabot-<i>version</i>/online.rc<br />
And run lambdabot via:<br />
<code><br />
lambdabot -e "rc ~/.cabal/share/lambdabot-<i>version</i>/online.rc"<br />
</code><br />
<br />
This may not be complete, please correct it if any more fixes are required, and as things are updated.<br />
<br />
----<br />
<br />
When I try to install mueval with GHC 7.2.1, I get a conflict:<br />
<br />
<code><br />
cannot configure show-0.4.1.1. It requires base <4<br />
mueval-0.8.1 requires base ==4.*<br />
</code><br />
<br />
=( [[User:Drb226|Dan Burton]] 04:50, 24 October 2011 (UTC)<br />
<br />
After many hacks, I was finally able to get lambdabot installed on 7.2.1. See the [http://tunes.org/~nef/logs/haskell/11.10.23 #haskell irc logs for 23 Oct 2011], around 22:00; I was rather verbose about stating what problems I ran into and what I did to solve them. [[User:Drb226|Dan Burton]] 21:18, 25 October 2011 (UTC)</div>Drb226https://wiki.haskell.org/Lambdabot/BuildingLambdabot/Building2011-10-24T04:50:13Z<p>Drb226: ghc 7.2.1 issues</p>
<hr />
<div>Unfortunately, some of the packages that [[Lambdabot]] depends on in [[Hackage]] do not, as of 9 January 2009, support [[GHC]] 6.10.<br />
Fortunately, the [[darcs]] repositories of most of these packages do support it.<br />
<br />
== To compile lambdabot on ghc >=6.10, follow the following steps ==<br />
<br />
Get the stuff from [[darcs]] repositories:<br />
<code><br />
darcs get http://code.haskell.org/HSP/haskell-src-exts<br />
darcs get http://code.haskell.org/mubot<br />
darcs get http://code.haskell.org/lambdabot<br />
</code><br />
<br />
Lets install haskell-src-exts from darcs (TODO: This may not actually be required, the one from Hackage might be good enough):<br />
<code><br />
cd haskell-src-exts<br />
cabal install<br />
cd ..<br />
</code><br />
<br />
Install mueval:<br />
<code><br />
cd mubot/mueval<br />
cabal install<br />
cd ../..<br />
</code><br />
<br />
Apply a patch to lambdabot and install it:<br />
<code><br />
cd lambdabot<br />
wget http://www.haskell.org/wikiupload/e/ed/Lambdabot.patch -O -|patch -p1<br />
cabal install<br />
cd ..<br />
</code><br />
<br />
Edit your online.rc file at ~/.cabal/share/lambdabot-<i>version</i>/online.rc<br />
And run lambdabot via:<br />
<code><br />
lambdabot -e "rc ~/.cabal/share/lambdabot-<i>version</i>/online.rc"<br />
</code><br />
<br />
This may not be complete, please correct it if any more fixes are required, and as things are updated.<br />
<br />
----<br />
<br />
When I try to install mueval with GHC 7.2.1, I get a conflict:<br />
<br />
<code><br />
cannot configure show-0.4.1.1. It requires base <4<br />
mueval-0.8.1 requires base ==4.*<br />
</code><br />
<br />
=( [[User:Drb226|Dan Burton]] 04:50, 24 October 2011 (UTC)</div>Drb226https://wiki.haskell.org/Dependent_typeDependent type2011-10-22T19:07:53Z<p>Drb226: /* Epigram */ fixing broken links; best guess on "Epigram Tutorial"</p>
<hr />
<div>__TOC__<br />
<br />
== The concept of dependent types ==<br />
<br />
=== General ===<br />
<br />
* [http://en.wikipedia.org/wiki/Dependent_types Wikipedia]<br />
* [http://www-sop.inria.fr/oasis/Caminha00/abstract.html Dependent Types in Programming] abstract in APPSEM'2000<br />
* [http://www.brics.dk/RS/01/10/BRICS-RS-01-10.ps.gz Do we need dependent types?] by Daniel Fridlender and Mia Indrika, 2001.<br />
<br />
<br />
=== Type theory ===<br />
<br />
Simon Thompson: [http://www.cs.kent.ac.uk/people/staff/sjt/TTFP/ Type Theory and Functional Programming]. Section 6.3 deals with dependent types, but because of the strong emphasis on [http://en.wikipedia.org/wiki/Curry_Howard_isomorphism Curry-Howard isomorphism] and the connections between logic and programming,<br />
the book seemed cathartic for me even from its beginning.<br />
<br />
Another interesting approach to Curry-Howard isomorphism and the concept of dependent type: [http://www.cs.chalmers.se/~aarne/course-langtech/lectures/lang09.html Lecture 9. Semantics and pragmatics of text and dialogue] dicsusses these concepts in the context of linguistics. Written by [http://www.cs.chalmers.se/~aarne/ Arne Ranta], see also [[Libraries and tools/Linguistics#Other functional or Haskell-related approaches to linguistics|his online course and other linguistical materials on the Linguistics wikipage]].<br />
<br />
[http://lists.seas.upenn.edu/mailman/listinfo/types-list Types Forum]<br />
<br />
=== Illative combinatory logic ===<br />
<br />
To see how Illative [[Combinatory logic]] deals with dependent types, see combinator '''G''' described in [http://citeseer.ist.psu.edu/246934.html Systems of Illative Combinatory Logic complete for first-order propositional and predicate calculus] by Henk Barendregt, Martin Bunder, Wil Dekkers.<br />
It seems to me that the dependent type construct<br />
<math>\forall x : S \Rightarrow T</math><br />
of Epigram corresponds to<br />
<math>\mathbf G\;S\;(\lambda x . T)</math><br />
in Illative Combinatory Logic. I think e.g. the followings should correspond to each other:<br />
* <math>\mathrm{realNullvector} :\;\;\;\forall n: \mathrm{Nat} \Rightarrow \mathrm{RealVector}\;n</math><br />
* <math>\mathbf G\;\,\mathrm{Nat}\;\,\mathrm{RealVector}\;\,\mathrm{realNullvector}</math><br />
<br />
<br />
== Dependently typed languages ==<br />
<br />
=== Epigram ===<br />
<br />
[http://www.e-pig.org/ Epigram] is a full dependently typed programming language, see especially<br />
* [http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.115.9718&rep=rep1&type=pdf Epigram Tutorial] by Conor McBride<br />
* and [http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.106.8190&rep=rep1&type=pdf Why dependent types matter] by Thorsten Altenkirch, Conor McBride and James McKinna).<br />
<br />
Dependent types (of this language) also provide a not-forgetful concept of '''views''' (already mentioned in the Haskell [[Future of Haskell#Extensions of Haskell]];<br />
the connection between these concepts is described in p. 32 of Epigram Tutorial (section ''4.6 Patterns Forget; Matching Is Remembering'').<br />
<br />
See Epigram also as [[Libraries and tools/Theorem provers|theorem prover]].<br />
<br />
=== Agda ===<br />
<br />
[http://www.cs.chalmers.se/~ulfn/Agda/ Agda] is a system for incrementally developing proofs and programs. Agda is also a functional language with dependent types. This language is similar to Epigram but has a more Haskell-like syntax.<br />
<br />
People who are interested also in theorem proving may see the [[Libraries and tools/Theorem provers|theorem provers]] page.<br />
<br />
=== Cayenne ===<br />
<br />
[http://www.cs.chalmers.se/~augustss/cayenne/index.html Cayenne] is influenced also by constructive type theory (see its page).<br />
<br />
Dependent types make it possible not to have a separate module language and a core language. This idea may concern Haskell too, see [[First-class module]] page.<br />
<br />
Depandent types make it useful also as a [[Libraries and tools/Theorem provers|theorem prover]].<br />
<br />
== Dependent types in Haskell programming ==<br />
<br />
=== Lightweight Dependent Typing ===<br />
[http://pobox.com/~oleg/ftp/Computation/lightweight-dependent-typing.html This web page] describes the lightweight approach<br />
and its applications, e.g., statically safe head/tail functions and<br />
the elimination<br />
of array bound check (even in such complex algorithms as Knuth-Morris-Pratt<br />
string search). The page also briefly describes `singleton types' (Hayashi and<br />
Xi).<br />
<br />
=== Library ===<br />
<br />
[http://www.dcs.st-and.ac.uk/~eb/ivor.php Ivor] is type theory based theorem proving library -- written by [http://www.dcs.st-and.ac.uk/~eb/index.php Edwin Brady] (see also the author's homepage, there are a lot of materials concerning dependent type theory there).<br />
<br />
=== Proposals ===<br />
John Hughes: [http://www.coverproject.org/TalksUntilSpring2004/DependentTypesInHaskell.pdf Dependent Types in Haskell (some ideas)].<br />
<br />
=== Simulating them ===<br />
* [http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.22.2636 Faking it: Simulating Dependent Types in Haskell], by Conor McBride<br />
* <s>[http://haskell.org/hawiki/SimulatingDependentTypes SimulatingDependentTypes] of HaWiki</s> (404 Error)<br />
* The [[Type#See also|''See also'' section of Type]] page contains links to many related idioms. Especially [[type arithmetic]] seems to me also a way yielding some tastes from dependent type theory.<br />
* On the usefulness of such idioms in practice, see HaskellDB's pages<br />
** [http://haskelldb.sourceforge.net/ updated] page (see ''Papers'' subsection on [http://haskelldb.sourceforge.net/#documentation Documentation])<br />
** which presupposes reading also paper on the [http://www.haskell.org/haskellDB/ original] page (see [http://www.haskell.org/haskellDB/doc.html Documentation subpage], PostScript version)<br />
<br />
[[Category:Theoretical foundations]]<br />
<br />
[[Category:Type-level programming]]</div>Drb226https://wiki.haskell.org/TypeclassopediaTypeclassopedia2011-10-18T22:52:46Z<p>Drb226: adding diagram</p>
<hr />
<div>The Typeclassopedia, by Brent Yorgey, was an article in [[the Monad.Reader]] issue 13 explaining several of the standard Haskell typeclasses, including Monoid, Applicative, Alternative, Arrow, and Traversable.<br />
<br />
The Typeclassopedia itself can be found here: [[Media:Typeclassopedia.pdf]].<br />
<br />
A summary of the entire article is at available at: http://typeclassopedia.citizen428.net/<br />
<br />
The entire issue of [[the Monad.Reader]] can be found here: http://www.haskell.org/wikiupload/8/85/TMR-Issue13.pdf<br />
<br />
[[Image:Typeclassopedia-diagram.png]]<br />
<br />
[[Category:Monad]]<br />
[[Category:Arrow]]</div>Drb226https://wiki.haskell.org/File:Typeclassopedia-diagram.pngFile:Typeclassopedia-diagram.png2011-10-18T22:51:53Z<p>Drb226: Relationships among standard Haskell type classes, Figure 1 as published in Typeclassopedia.</p>
<hr />
<div>Relationships among standard Haskell type classes, Figure 1 as published in Typeclassopedia.</div>Drb226https://wiki.haskell.org/Research_papers/Monads_and_arrowsResearch papers/Monads and arrows2011-10-18T03:21:45Z<p>Drb226: /* Arrows in Haskell */ updating broken link to Generalizing Monads to Arrows with top google hit</p>
<hr />
<div>__TOC__<br />
<br />
==Monads==<br />
[[Category:Monad]] [[Category:Arrow]] [[Category:Research]]<br />
See also [[Monad]] and [[Arrow]] HaskellWiki pages.<br />
<br />
;[http://research.microsoft.com/~simonpj/Papers/state-lasc.ps.gz State in Haskell]<br />
:SL Peyton Jones and J Launchbury, Lisp and Symbolic Computation 8(4), Dec 1995, pp293-341. (Cited by 109)<br />
<br />
;[http://research.microsoft.com/~simonpj/Papers/lazy-functional-state-threads.ps.Z Lazy functional state threads] <br />
:SL Peyton Jones and J Launchbury, SIGPLAN Symposium on Programming Language Design and Implementation (PLDI'94), Orlando, June 1994, pp24-35. (Cited by 127))<br />
<br />
;[http://research.microsoft.com/~simonpj/Papers/imperative.ps.Z Imperative functional programming]<br />
:SL Peyton Jones and PL Wadler, 20th ACM Symposium on Principles of Programming Languages (POPL'93), Charleston, Jan 1993, pp71-84. (Cited by 289)<br />
<br />
;[http://www.informatik.uni-bonn.de/~ralf/publications/FLOPS98.ps.gz Prological features in a functional setting - axioms and implementations] <br />
:Ralf Hinze. In Masahiko Sato, Yoshihito Toyama, editors, Third Fuji International Symposium on Functional and Logic Programming (FLOPS'98), Kyoto University, Japan, April 1998, pp. 98-122. World Scientific, Singapore, New Jersey, London, Hong Kong. (Cited by 9)<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.42.2605 Composing Monads]<br />
:Mark P. Jones and Luc Duponcheel Research Report YALEU/DCS/RR-1004, Yale University, New Haven, Connecticut, USA, December 1993. (Cited by 66))<br />
<br />
;[http://homepages.inf.ed.ac.uk/wadler/papers/effectstocl/effectstocl.ps.gz The marriage of effects and monads]<br />
:Philip Wadler and Peter Thiemann. Submitted to ACM Transactions on Computational Logic. (Cited by 62)<br />
<br />
;[http://homepages.inf.ed.ac.uk/wadler/papers/monadsdeclare/monadsdeclare.ps.gz How to declare an imperative] <br />
:Philip Wadler. ACM Computing Surveys, 29(3):240--263, September 1997. A shorter version was an invited paper at ILPS 95, appearing in John Lloyd, editor, International Logic Programming Symposium, MIT Press, December 1995. (Cited by 92)<br />
<br />
;[http://homepages.inf.ed.ac.uk/wadler/papers/composable/composable.ps.gz Monads and composable continuations]<br />
:Philip Wadler. Lisp and Symbolic Computation, Special issue on continuations, 7(1):39-56, January 1994. (Cited by 34)<br />
<br />
;[http://homepages.inf.ed.ac.uk/wadler/topics/monads.html#marktoberdorf Monads for functional programming]<br />
:Philip Wadler. In M. Broy, editor, Marktoberdorf Summer School on Program Design Calculi, Springer Verlag, NATO ASI Series F: Computer and systems sciences, Volume 118, August 1992. Also in J. Jeuring and E. Meijer, editors, Advanced Functional Programming, Springer Verlag, LNCS 925, 1995. (Cited by 237)<br />
<br />
;[http://homepages.inf.ed.ac.uk/wadler/papers/monadscomb/monadscomb.ps.gz Combining monads]<br />
:David King and Philip Wadler. Glasgow Workshop on Functional Programming, Springer Verlag Workshops in Computing Series, Ayr, July 1992. (Cited by 42)<br />
<br />
;[http://homepages.inf.ed.ac.uk/wadler/papers/essence/essence.ps.gz The essence of functional programming] <br />
:Philip Wadler. Invited talk, 19'th Symposium on Principles of Programming Languages, ACM Press, Albuquerque, January 1992. (Cited by 407)<br />
<br />
;[http://okmij.org/ftp/Computation/proving-monad-laws.txt How to prove monad laws]<br />
:Oleg Kiselyov, v1.1, Sep 2, 2003, Originally posted as "Re: proving the monad laws" on the Haskell mailing list<br />
<br />
;[http://web.engr.oregonstate.edu/~erwig/papers/abstracts.html#SCP04 Monadification of Functional Programs]<br />
:Martin Erwig and Deling Ren. Science of Computer Programming, Vol. 52, No. 1-3, 101-129, 2004<br />
<br />
;[http://web.engr.oregonstate.edu/~erwig/papers/abstracts.html#IFL98 The Categorical Imperative - Or: How to Hide Your State Monads]<br />
:Martin Erwig. 10th Int. Workshop on Implementation of Functional Languages (IFL'98), 1-25, 1998<br />
<br />
;[http://portal.acm.org/citation.cfm?id=581482 Monads for Incremental Computing]<br />
:Magnus Carlsson, ICFP 2002, 2002. <br />
<br />
;[http://portal.acm.org/citation.cfm?id=581482 Monads for Incremental Computing]<br />
:Magnus Carlsson, ICFP'02.<br />
<br />
===Monad comprehensions===<br />
<br />
;[http://homepages.inf.ed.ac.uk/wadler/papers/monads/monads.ps.gz Comprehending monads]<br />
:Philip Wadler. Mathematical Structures in Computer Science, Special issue of selected papers from 6'th Conference on Lisp and Functional Programming, 2:461-493, 1992. (Cited by 469)<br />
<br />
===Monad transformers===<br />
<br />
;[http://www.informatik.uni-bonn.de/~ralf/publications/ICFP00.ps.gz Deriving Backtracking Monad Transformers]<br />
:Ralf Hinze. In Phil Wadler, editor, Proceedings of the 2000 International Conference on Functional Programming, Montreal, Canada, September 18-20, 2000.<br />
<br />
;[http://www.informatik.uni-bonn.de/~ralf/publications/IAI-TR-99-1.ps.gz Deriving monad transformers] <br />
:Ralf Hinze. Technical Report IAI-TR-99-1, Institut fr Informatik III, Universitt Bonn, January 1999.<br />
<br />
;[http://okmij.org/ftp/papers/LogicT.pdf Backtracking, Interleaving, and Terminating Monad Transformers]<br />
:Oleg Kiselyov, Chung-chieh Shan, Daniel P. Friedman and Amr Sabry, Functional Pearl, to be presented at ICFP 2005.<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.2151 Modular Compilers Based on Monad Transformers]<br />
:Harrison, Kamin (1998) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.40.8121 Semantic Lego]<br />
:Espinosa (1995) <br />
<br />
===Recursion===<br />
<br />
;[http://haskell.readscheme.org/servlets/cite.ss?pattern=erkok-launchbury-moran-tia-02 Semantics of Value Recursion for Monadic Input/Output]<br />
:Levent Erkök, John Launchbury and Andrew Moran. Journal of Theoretical Informatics and Applications. 36. 2. 2002.<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.6.5172 A Recursive do for Haskell]<br />
:Levent Erkök and John Launchbury. Proceedings of the 2002 ACM SIGPLAN workshop on Haskell. Pittsburgh, Pennsylvania. 29 - 37 2002 ISBN 1-58113-605-6<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.15.1543 Value recursion in monadic computations]<br />
:Levent Erkök. PhD. Thesis. OGI School of Science and Engineering. October 2002.<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.15.736 Semantics of fixIO]<br />
:Levent Erkök, John Launchbury and Andrew Moran. Workshop on Fixed Points in Computer Science (FICS'01). 2001. <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.5313 Recursive Monadic Bindings]<br />
:Levent Erkok and John Launchbury. Proceedings of the International Conference on Functional Programming ICFP'00. 2000.<br />
<br />
===Applications of monads===<br />
<br />
;[http://www.cs.chalmers.se/~rjmh/Globals.ps Global Variables in Haskell]<br />
:John Hughes. 2004. JFP.<br />
<br />
;[http://www.informatik.uni-bonn.de/~ralf/publications/IAI-TR-96-9.ps.gz Monadic-style backtracking]<br />
:Ralf Hinze. Technical Report IAI-TR-96-9, Institut fr Informatik III, Universitt Bonn, October 1996.<br />
<br />
;[http://www.math.chalmers.se/~koen/pubs/entry-jfp99-monad.html A Poor Man's Concurrency Monad]<br />
:Koen Claessen, Journal of Functional Programming. 9(3). 313--323. 1999.<br />
<br />
;[http://groups.csail.mit.edu/mac/users/dae/related-papers/steele.ps.Z Building Interpreters by Composing Monads]<br />
:Guy L. Steele, Jr.. Principles of Programming Languages (POPL'94). January 1994. (Cited by 67)<br />
<br />
;[http://www.cs.yale.edu/users/liang-sheng/popl95.ps.gz Monad Transformers and Modular Interpreters]<br />
:Sheng Liang, Paul Hudak, and Mark P. Jones, In Conference Record of POPL'95: 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Francisco, CA, January 1995 (110 citations)<br />
<br />
;[http://www.cs.cornell.edu/people/fluet/research/rgn-monad/index.html Monadic Regions]<br />
:Fluet and Morrisett; To appear in the Journal of Functional Programming. "Region-based type systems provide programmer control over memory management without sacrificing type-safety... we show that plain old parametric polymorphism, as found in Haskell, is all that is needed."<br />
<br />
;[http://research.microsoft.com/~emeijer/Papers/XLinq%20XML%20Programming%20Refactored%20(The%20Return%20Of%20The%20Monoids).htm XLinq: XML Programming Refactored (The Return Of The Monoids)]<br />
:Erik Meijer and Brian Beckman<br />
<br />
;[http://okmij.org/ftp/Computation/monadic-shell.html Monadic Shell]<br />
:Oleg Kiselyov<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.15.7796 Coalgebraic Monads]<br />
:Ghani, Lth, De Marchi (2002) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.8.9817 Monad Translating Inductive and Coinductive Types]<br />
:Uustalu (2003)<br />
<br />
;[http://citeseer.ist.psu.edu/old/meijer95merging.html Merging Monads and Folds for Functional Programming]<br />
:Meijer, Jeuring (1995) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.3718 Monadic Maps and Folds for Arbitrary Datatypes]<br />
:Fokkinga (1994) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.36.7816 Modular Denotational Semantics for Compiler Construction]<br />
:Sheng Liang (1996) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.340 Monadic Parser Combinators]<br />
:Hutton, Meijer (1996) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.49.6020l Building Domain-Specific Embedded Languages]<br />
:Paul Hudak (1996)<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.46.1260 Programming Reactive Systems in Haskell]<br />
;Finne, Jones (1994) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.48.8225 Costing Parallel Programs as a Function of Shapes]<br />
;Jay (1998)<br />
<br />
;[http://citeseer.ist.psu.edu/old/demeuter97monads.html Monads as a theoretical foundation for AOP]<br />
:De Meuter (1997) <br />
<br />
;[http://arxiv.org/pdf/cs.CL/0205026 Monads for natural language semantics]<br />
:Chung-chieh Shan (Harvard University). Journal-ref: Proceedings of the 2001 European Summer School in Logic, Language and Information student session, ed. Kristina Striegnitz, 285-298<br />
<br />
;[http://arxiv.org/abs/cs.NA/0605058 A Monadic, Functional Implementation of Real Numbers]<br />
:Russell O'Connor, 2006. Mathematical Structures in Computer Science.<br />
<br />
;[http://research.microsoft.com/%7Esimonpj/papers/control/ A monadic framework for delimited continuations]<br />
:Kent Dybvig, Simon Peyton Jones, and Amr Sabry.<br />
<br />
See also [[Monad#Monads_in_other_languages|monads in other languages]].<br />
<br />
===Comonads===<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.45.4741 Codata and Comonads in Haskell]<br />
:Kieburtz - 1999<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.16.9369 The Dual of Substitution is Redecoration]<br />
:Tarmo Uustalu, Varmo Vene. Trends in Functional Programming 3. (2002)<br />
<br />
;[http://citeseer.ist.psu.edu/context/1959424/0 Monads and Comonads]<br />
:Ghani et al.<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.18.5587 Recursion Schemes from Comonads]<br />
:Uustalu, Vene, Pardo (2001)<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.45.4952 Computational Comonads and Intensional Semantics]<br />
:Brookes, Geva, 1992<br />
<br />
;[http://sigfpe.blogspot.com/2006/06/monads-kleisli-arrows-comonads-and.html Tutorial: Monads, Kleisli Arrows, Comonads and other Rambling Thoughts]<br />
<br />
===Monad theory===<br />
<br />
;[http://www.disi.unige.it/person/MoggiE/ftp/ic91.ps.gz Notions of computation and monads]<br />
:Eugenio Moggi. Information and Computation, 93(1):55-92, July 1991 ( Cited by 649)<br />
<br />
;[http://www.disi.unige.it/person/MoggiE/ftp/lc88.ps.gz Computational lambda-calculus and monads]<br />
:Eugenio Moggi. Logic in Computer Science, 1989. LICS '89, Proceedings., Fourth Annual Symposium on (1989), pp. 14-23. <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.46.2016 Representing Layered Monads]<br />
:Andrzej Filinski. In Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 175--188, San Antonio, Texas, USA, January 1999. ACM Press.<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.37.5845 Monads and Effects]<br />
:Nick Benton, John Hughes and Eugenio Moggi. APPSEM'00 Summer School, LNCS 2395, 2002<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.27.9631 Correctness of Monadic State: An Imperative Call-by-Need Calculus]<br />
:Ariola, Sabry (1998) <br />
<br />
;[http://www.disi.unige.it/person/MoggiE/ftp/jfp01.ps.gz Monadic Encapsulation of Effects: A Revised Approach (extended version)]<br />
:Journal of Functional Programming, 11(6), 2001.<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.47.730 Towards a Mathematical Operational Semantics] <br />
:Turi, Plotkin (1997) (53 citations)<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.47.9447 Equivalence in Functional Languages with Effects]<br />
:Mason, Talcott (1991) (49 citations) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.48.2029 Computational Types from a Logical Perspective]<br />
:Benton, Bierman (1995)<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.35.4895 A Modular Monadic Action Semantics]<br />
:Wansbrough (1997) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.5895 Functor Categories and Two-Level Languages]<br />
:Moggi (1998) <br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.3812 A Category-Theoretic Account of Program Modules]<br />
:Moggi (1994)<br />
<br />
===Reasoning about Monads===<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.52.8527 Promotional Transformation of Monadic Programs]<br />
:Hu, Iwasaki (1995)<br />
<br />
;[http://www.itu.dk/~kss/papers/icfp07.pdf Inductive Reasoning about Effectful Data Types]<br />
:Andrzej Filinski and Kristian Støvring. International Conference on Functional Programming (ICFP'07), Proceedings, ACM Press, 2007.<br />
<br />
;[http://wwwtcs.inf.tu-dresden.de/~voigt/icfp09.pdf Free Theorems Involving Type Constructor Classes]<br />
:Janis Voigtländer. International Conference on Functional Programming (ICFP'09), Proceedings, ACM Press, 2009.<br />
<br />
<br />
==Arrows==<br />
<br />
See also [[Arrow]] HaskellWiki page.<br />
<br />
===Arrows in Haskell===<br />
<br />
;[http://www.ittc-ku.net/Projects/SLDG/filing_cabinet/Hughes_Generalizing_Monads_to_Arrows.pdf Generalising Monads to Arrows],<br />
:John Hughes, in Science of Computer Programming 37, pp67-111, May 2000. (draft online)<br />
<br />
;[http://www.soi.city.ac.uk/~ross/papers/notation.html A New Notation for Arrows]<br />
:Ross Paterson. In ICFP 2001, Firenze, Italy, pp229-240]<br />
<br />
;[http://www.soi.city.ac.uk/~ross/papers/fop.html Arrows and Computation]<br />
:Ross Paterson, in The Fun of Programming (Jeremy Gibbons and Oege de Moor, Eds.), pp201-222, Palgrave, 2003.<br />
<br />
===Applications of arrows===<br />
<br />
;[http://apocalypse.org/~antony/work/pubs/genuinely-functional-guis.pdf Genuinely Functional User Interfaces]<br />
:Anthony Courtney and Conal Elliott, in Haskell Workshop 2001, Firenze, Italy, pp41-69.<br />
<br />
;[http://cs-www.cs.yale.edu/homes/nilsson/Publications/afp2002.pdf Arrows, Robots, and Functional Reactive Programming]<br />
:Paul Hudak, Henrik Nilsson, Anthony Courtney and Jon Peterson, in Advanced Functional Programming, 4th International School, (Johan Jeuring and Simon Peyton Jones eds.), Oxford, Springer LNCS 2638, 2003.<br />
<br />
;[http://www.cs.chalmers.se/~patrikj/poly/dc/ Polytypic compact printing and parsing]<br />
:Patrik Jansson and Johan Jeuring, In Proceedings European Symposium on Programming, LNCS 1576, pp273-287, Springer, 1999.<br />
<br />
;[http://www.md.chalmers.se/~patrikj/poly/dataconv/ Polytypic data conversion programs]<br />
:Patrik Jansson and Johan Jeuring, Science of Computer Programming 43(1), pp35-75, 2002.<br />
<br />
;[http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.20.7652 Hyperfunctions]<br />
:Sava Krstic, John Launchbury and Dusko Pavlovic, Workshop on Fixed Points in Computer Science, Sep 2001.<br />
<br />
;[http://cs-www.cs.yale.edu/homes/nilsson/Publications/hw2002.pdf Functional Reactive Programming, Continued]<br />
:Henrik Nilsson, Antony Courtney, and John Peterson. Proceedings of the 2002 ACM SIGPLAN Haskell Workshop (Haskell'02), pages 51 - 64, Pittsburgh, Pennsylvania, USA, October 2002. ACM Press.<br />
<br />
;[http://www.cs.ru.nl/A.vanWeelden/bi-arrows/ There and back again: arrows for invertible programming]<br />
:Artem Alimarine, Sjaak Smetsers, Arjen van Weelden, Marko van Eekelen, Rinus Plasmeijer. Proceedings of the 2005 ACM SIGPLAN workshop on Haskell. Tallinn, Estonia, 86 - 97 2005 ISBN 1-59593-071-X<br />
<br />
Free version of the above paper at http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.60.7278 or one of the other citeseer mirrors<br />
<br />
;[http://web.archive.org/web/20071225224717/http://www.cse.ogi.edu/~magnus/ProdArrows/ ProdArrows -- Arrows for Fudgets]<br />
:Magnus Carlsson, 2001.<br />
<br />
;[http://www.cs.umd.edu/~jfoster/arrows.pdf Directing JavaScript with Arrows] :Jeffrey S. Foster et al, 2008 (submitted)<br />
<br />
===Arrow theory===<br />
<br />
;[http://www.math.mcgill.ca/~rags/bang/context1.ps.gz Categories for Computation in Context and Unified Logic]<br />
:Richard Blute, J.R.B. Cockett and R.A.G. Seely. In Journal of Pure and Applied Algebra 116:49-98, 1997.<br />
<br />
;[http://www.cs.ru.nl/~heunen/publications/2006/arrows/arrows.pdf Arrows, like Monads, are Monoids]<br />
:Chris Heunen and Bart Jacobs. In Electronic Notes in Theoretical Computer Science, Volume 158, 5 May 2006, Pages 219-236.<br />
<br />
;[http://www.dcs.qmw.ac.uk/~edmundr/pubs/mscs97/premoncat.ps Premonoidal Categories and Notions of Computation]<br />
:John Power and Edmund Robinson. In Mathematical Structures in Computer Science 7(5):453-468, 1997.<br />
<br />
;[http://research.microsoft.com/~nick/premonitapdf.pd Traced Premonoidal Categories]<br />
:Nick Benton and Martin Hyland. In Theoretical Informatics and Applications 37(4):273-299, 2003.<br />
<br />
;[http://www.cs.bham.ac.uk/~hxt/research/TACSfinal.ps Environments, Continuation Semantics and Indexed Categories]<br />
:John Power and Hayo Thielecke. In Proc. Theoretical Aspects of Computer Science, LNCS 1281, pp 391-414, 1997.<br />
<br />
;[http://www.cs.bham.ac.uk/~hxt/research/closed-freyd-and-kappa.ps Closed Freyd- and kappa-categories]<br />
:John Power and Hayo Thielecke. ICALP'99, LNCS 1644, Springer, 1999.</div>Drb226https://wiki.haskell.org/User:Drb226User:Drb2262011-10-10T19:59:05Z<p>Drb226: </p>
<hr />
<div>Hi, I'm Dan Burton. You may know me as:<br />
<br />
* [http://www.reddit.com/user/drb226/ drb226 on reddit]<br />
* [http://stackoverflow.com/users/208257/dan-burton Dan Burton on StackOverflow]<br />
* "DanBurton" on #haskell IRC<br />
* [https://plus.google.com/101638406996764973147/posts Dan Burton on Google+]<br />
* [http://twitter.com/#!/drb226 drb226 on twitter]<br />
* The only Utahn to sign up on http://haskellers.com (double click on the map a few times to zoom in; look at Utah :)</div>Drb226https://wiki.haskell.org/User:Drb226User:Drb2262011-10-10T19:58:45Z<p>Drb226: </p>
<hr />
<div>Hi, I'm Dan Burton. You may know me as:<br />
<br />
* [http://www.reddit.com/user/drb226/ drb226 on reddit]<br />
* [http://stackoverflow.com/users/208257/dan-burton Dan Burton on StackOverflow].<br />
* "DanBurton" on #haskell IRC<br />
* [https://plus.google.com/101638406996764973147/posts Dan Burton on Google+]<br />
* [http://twitter.com/#!/drb226 drb226 on twitter]<br />
* The only Utahn to sign up on http://haskellers.com (double click on the map a few times to zoom in; look at Utah :)</div>Drb226https://wiki.haskell.org/User:Drb226User:Drb2262011-10-10T19:58:24Z<p>Drb226: </p>
<hr />
<div>Hi, I'm Dan Burton. You may know me as:<br />
<br />
* [http://www.reddit.com/user/drb226/ drb226 on reddit].<br />
* [http://stackoverflow.com/users/208257/dan-burton Dan Burton on StackOverflow].<br />
* "DanBurton" on #haskell IRC.<br />
* [https://plus.google.com/101638406996764973147/posts Dan Burton on Google+]<br />
* [http://twitter.com/#!/drb226 drb226 on twitter]<br />
* The only Utahn to sign up on http://haskellers.com (double click on the map a few times to zoom in; look at Utah :)</div>Drb226https://wiki.haskell.org/User:Drb226User:Drb2262011-10-10T19:51:16Z<p>Drb226: New page: Hi, I'm Dan Burton.</p>
<hr />
<div>Hi, I'm Dan Burton.</div>Drb226https://wiki.haskell.org/VirtuaHacVirtuaHac2011-10-10T19:50:56Z<p>Drb226: /* VirtuaHac 2011.10 */ Dan Burton's time zone</p>
<hr />
<div>VirtuaHac is a hackathon for the rest of us! Instead of travel and lodging expenses, we plan to host a collective hacking session using technology and distance collaboration tools.<br />
<br />
== Collaboration Tools ==<br />
<br />
The tools we plan to use are:<br />
<br />
* Google+ (http://plus.google.com) hangouts for real-time video (or audio-only) chat.<br />
<br />
* Git/Darcs: We recommend (but don't require) using github or patch-tag for projects that are hacked on. You probably want to create a hackathon-specific repo to make it easier for hackathon members to collaborate without handing out permissions to the real code. Even if it's not through github or patch-tag, anyone sponsoring a project will need to provide an easy way to manage collective access to the source code. If that's 'darcs send', you'll have to be pretty responsive.<br />
<br />
* This Wiki: Make sure you have a Haskellwiki account, as we'll be posting links to current projects here.<br />
<br />
== VirtuaHac 2011.10 ==<br />
<br />
The first VirtuaHac is October 21-23, 2011.<br />
<br />
Signups (include your time zone as GMT +/- x, and projects you know something about and are willing or interested in working on):<br />
<br />
* Chris Smith (GMT-7)<br />
** snap-typed-sessions (mysnapsession in Hackage)<br />
** gloss-web (https://github.com/cdsmith/gloss-web)<br />
** mvclient (in Hackage) - willing only if anyone else is so motivated<br />
** GHC Issue #4900 or #5527 - would need someone experienced in GHC<br />
** I'm also happy to join in other projects<br />
<br />
* Clint Moore<br />
** I'll work on anything I'm capable of.<br />
<br />
* Etienne `AtnNn` Laurin<br />
** GHCi<br />
** Yesod<br />
<br />
* Jens Petersen (juhp)<br />
** probably something cabal/packaging related<br />
<br />
* Hemanth Kapila<br />
** c2hs based bindings to libharu [http://libharu.org/wiki/Main_Page]<br />
** I'm happy to join in other projects too.<br />
<br />
* Dan Burton (GMT-6)<br />
** Anything I can help with<br />
<br />
* Edward Amsden<br />
** I'll be open to working on anything, but I will be at a conference so my time will be limited. I'm especially open to learning to hack on GHC.<br />
<br />
== Procedures ==<br />
<br />
Once VirtuaHac starts, we'll create a Lobby section of this wiki page. To start up a collaboration:<br />
<br />
1. Create a Hangout on Google+. Name it to indicate it's part of VirtuaHac.<br />
2. Post a link to the Hangout in the Lobby section.<br />
3. As applicable, post links to version control or other resources under the project in Lobby, too.<br />
<br />
As needed, also feel free to create "VirtuaHac Break Room" Hangouts, for chatting among people who aren't currently working on a collaboration. These could be a good chance to chat with others about what they've got in the pipe, and start collaborations.<br />
<br />
If a collaboration is at or very close to 10 people (the size limit for Google+ hangouts), you may want to break it into subprojects.</div>Drb226https://wiki.haskell.org/VirtuaHacVirtuaHac2011-10-10T04:22:21Z<p>Drb226: /* VirtuaHac 2011.10 */ + me</p>
<hr />
<div>VirtuaHac is a hackathon for the rest of us! Instead of travel and lodging expenses, we plan to host a collective hacking session using technology and distance collaboration tools.<br />
<br />
== Collaboration Tools ==<br />
<br />
The tools we plan to use are:<br />
<br />
* Google+ (http://plus.google.com) hangouts for real-time video (or audio-only) chat.<br />
<br />
* Git/Darcs: We recommend (but don't require) using github or patch-tag for projects that are hacked on. You probably want to create a hackathon-specific repo to make it easier for hackathon members to collaborate without handing out permissions to the real code. Even if it's not through github or patch-tag, anyone sponsoring a project will need to provide an easy way to manage collective access to the source code. If that's 'darcs send', you'll have to be pretty responsive.<br />
<br />
* This Wiki: Make sure you have a Haskellwiki account, as we'll be posting links to current projects here.<br />
<br />
== VirtuaHac 2011.10 ==<br />
<br />
The first VirtuaHac is October 21-23, 2011.<br />
<br />
Signups (including projects you know something about and are willing or interested in working on):<br />
<br />
* Chris Smith<br />
** snap-typed-sessions (mysnapsession in Hackage)<br />
** gloss-web (https://github.com/cdsmith/gloss-web)<br />
** mvclient (in Hackage) - willing only if anyone else is so motivated<br />
** GHC Issue #4900 or #5527<br />
** I'm also happy to join in other projects<br />
<br />
* Clint Moore<br />
** I'll work on anything I'm capable of.<br />
<br />
* Etienne `AtnNn` Laurin<br />
** GHCi<br />
** Yesod<br />
<br />
* Jens Petersen (juhp)<br />
** probably something cabal/packaging related<br />
<br />
* Hemanth Kapila<br />
** c2hs based bindings to libharu [http://libharu.org/wiki/Main_Page]<br />
** I'm happy to join in other projects too.<br />
<br />
* Dan Burton<br />
** Anything I can help with<br />
<br />
== Procedures ==<br />
<br />
Once VirtuaHac starts, we'll create a Lobby section of this wiki page. To start up a collaboration:<br />
<br />
1. Create a Hangout on Google+. Name it to indicate it's part of VirtuaHac.<br />
2. Post a link to the Hangout in the Lobby section.<br />
3. As applicable, post links to version control or other resources under the project in Lobby, too.<br />
<br />
As needed, also feel free to create "VirtuaHac Break Room" Hangouts, for chatting among people who aren't currently working on a collaboration. These could be a good chance to chat with others about what they've got in the pipe, and start collaborations.<br />
<br />
If a collaboration is at or very close to 10 people (the size limit for Google+ hangouts), you may want to break it into subprojects.</div>Drb226https://wiki.haskell.org/MultiCaseMultiCase2011-09-30T04:20:34Z<p>Drb226: </p>
<hr />
<div>Inspired by http://stackoverflow.com/questions/7603509/haskell-syntax-for-or-in-case-expressions<br />
<br />
It is proposed that Haskell allow multiple pattern matches in a case statement to map to a single right-hand-side expression.<br />
<br />
<haskell><br />
factorial :: Int -> Int<br />
factorial n = case n of<br />
0, 1 -> 1<br />
_ | n < 0 -> undefined<br />
_ -> n * factorial (pred n)<br />
<br />
-- without this suggested extension,<br />
-- the cases of 0 and 1 would have to be handled separately.<br />
</haskell><br />
<br />
If the right-hand-side expression utilizes bound variables from the pattern match, then all grouped pattern matches must bind the same variable.<br />
<br />
<haskell><br />
unEither :: Either a a -> a<br />
unEither eitherVal = case eitherVal of<br />
Left v, Right v -> v<br />
</haskell><br />
<br />
This is because only one of the pattern matches will occur. Clearly, the RHS cannot draw from multiple differing pattern matches. This would be an error.<br />
<br />
<haskell><br />
-- this would be a scoping error<br />
eitherSum :: Either Int Int -> Int<br />
eitherSum eitherVal case eitherVal of<br />
Left l, Right r -> l + r<br />
</haskell><br />
<br />
An additional example:<br />
<haskell><br />
-- modified example from Haskell School of Music<br />
getDur :: Primitive a -> Dur<br />
getDur p = case p of<br />
ModDur (Tempo r) d -> d / r<br />
Note d _, Rest d, ModDur _ d -> d <br />
-- notice how we don't have to write `-> d` for<br />
-- each of the 3 trivial cases; they all share the same RHS<br />
<br />
-- layout rules should also permit<br />
-- splitting the shared matches over multiple lines<br />
getDur' :: Primitive a -> Dur<br />
getDur' p = case p of<br />
ModDur (Tempo r) d -> d / r<br />
Note d _,<br />
Rest d,<br />
ModDur _ d -> d<br />
</haskell><br />
<br />
<br />
The comma syntax would work for combining the outermost level of pattern matches in case statements. Something more interesting might be to allow nested options in patterns. Using `|` syntax:<br />
<br />
<haskell><br />
case expr of<br />
(GT|LT):foo -> expr1<br />
EQ:bar -> expr2<br />
<br />
-- This could be written more verbosely with Haskell's guard syntax:<br />
case expr of<br />
x:foo | x == GT || x == LT -> expr1<br />
EQ:bar -> expr2<br />
<br />
-- Or by simply duplicating the RHS<br />
case expr of<br />
GT:foo -> expr1<br />
LT:foo -> expr1<br />
EQ:bar -> expr2<br />
</haskell><br />
<br />
Using `|` is a problem, however, since it would conflict with guard syntax. Using `,` is also a problem for nested options such as this, because it conflicts with pattern matching on tuples:<br />
<br />
<haskell><br />
case expr of<br />
(GT,LT):foo -> expr1<br />
</haskell><br />
<br />
Nested case pattern options may be too complex to actually be useful. But it could be convenient to have it at the outermost level, in which case, the comma syntax should work decently. There would still be some ambiguity when guards are included<br />
<br />
<haskell><br />
case expr of<br />
pat1 | guard1, guard2 -> expr1<br />
</haskell><br />
<br />
In the above case, it might be considered ambiguous whether or not guard2 is a guard, or whether it should actually be considered as pat2, another pattern.</div>Drb226https://wiki.haskell.org/MultiCaseMultiCase2011-09-30T04:18:38Z<p>Drb226: </p>
<hr />
<div>Inspired by http://stackoverflow.com/questions/7603509/haskell-syntax-for-or-in-case-expressions<br />
<br />
It is proposed that Haskell allow multiple pattern matches in a case statement to map to a single right-hand-side expression.<br />
<br />
<haskell><br />
factorial :: Int -> Int<br />
factorial n = case n of<br />
0, 1 -> 1<br />
_ | n < 0 -> undefined<br />
_ -> n * factorial (pred n)<br />
<br />
-- without this suggested extension,<br />
-- the cases of 0 and 1 would have to be handled separately.<br />
</haskell><br />
<br />
If the right-hand-side expression utilizes bound variables from the pattern match, then all grouped pattern matches must bind the same variable.<br />
<br />
<haskell><br />
unEither :: Either a a -> a<br />
unEither eitherVal = case eitherVal of<br />
Left v, Right v -> v<br />
</haskell><br />
<br />
This is because only one of the pattern matches will occur. Clearly, the RHS cannot draw from multiple differing pattern matches. This would be an error.<br />
<br />
<haskell><br />
-- this would be a scoping error<br />
eitherSum :: Either Int Int -> Int<br />
eitherSum eitherVal case eitherVal of<br />
Left l, Right r -> l + r<br />
</haskell><br />
<br />
An additional example:<br />
<haskell><br />
-- modified example from Haskell School of Music<br />
getDur :: Primitive a -> Dur<br />
getDur p = case p of<br />
ModDur (Tempo r) d -> d / r<br />
Note d _, Rest d, ModDur _ d -> d <br />
-- notice how we don't have to write `-> d` for<br />
-- each of the 3 trivial cases; they all share the same RHS<br />
<br />
-- layout rules should also permit<br />
-- splitting the shared matches over multiple lines<br />
getDur' :: Primitive a -> Dur<br />
getDur' p = case p of<br />
ModDur (Tempo r) d -> d / r<br />
Note d _,<br />
Rest d,<br />
ModDur _ d -> d<br />
</haskell><br />
<br />
<br />
The comma syntax would work for combining the outermost level of pattern matches in case statements. Something more interesting might be to allow nested options in patterns. Using `|` syntax:<br />
<br />
<haskell><br />
case expr of<br />
(GT|LT):foo -> expr1<br />
EQ:bar -> expr2<br />
<br />
-- This could be written more verbosely with Haskell's guard syntax:<br />
case expr of<br />
x:foo | x == GT || x == LT -> expr1<br />
EQ:bar -> expr2<br />
<br />
-- Or by simply duplicating the RHS<br />
case expr of<br />
GT:foo -> expr1<br />
LT:foo -> expr1<br />
EQ:bar -> expr2<br />
</haskell><br />
<br />
Using `|` is a problem, however, since it would conflict with guard syntax. Using `,` is also a problem for nested options such as this, because it conflicts with pattern matching on tuples:<br />
<br />
<haskell><br />
case expr of<br />
(GT,LT):foo -> expr1<br />
</haskell><br />
<br />
Nested case pattern options may be too complex to actually be useful. But it could be convenient to have it at the outermost level, in which case, the comma syntax should work decently. There would still be some ambiguity when guards are included<br />
<br />
<haskell><br />
case expr of<br />
pat1 | guard1, guard2 -> expr1<br />
<haskell><br />
<br />
In the above case, it might be considered ambiguous whether or not guard2 is a guard, or whether it should actually be considered as pat2, another pattern.</div>Drb226https://wiki.haskell.org/MultiCaseMultiCase2011-09-30T03:47:15Z<p>Drb226: New page: Inspired by http://stackoverflow.com/questions/7603509/haskell-syntax-for-or-in-case-expressions It is proposed that Haskell allow multiple pattern matches in a case statement to map to a...</p>
<hr />
<div>Inspired by http://stackoverflow.com/questions/7603509/haskell-syntax-for-or-in-case-expressions<br />
<br />
It is proposed that Haskell allow multiple pattern matches in a case statement to map to a single right-hand-side expression.<br />
<br />
<haskell><br />
factorial :: Int -> Int<br />
factorial n = case n of<br />
0, 1 -> 1<br />
_ | n < 0 -> undefined<br />
_ -> n * factorial (pred n)<br />
<br />
-- without this suggested extension,<br />
-- the cases of 0 and 1 would have to be handled separately.<br />
</haskell><br />
<br />
If the right-hand-side expression utilizes bound variables from the pattern match, then all grouped pattern matches must bind the same variable.<br />
<br />
<haskell><br />
unEither :: Either a a -> a<br />
unEither eitherVal = case eitherVal of<br />
Left v, Right v -> v<br />
</haskell><br />
<br />
This is because only one of the pattern matches will occur. Clearly, the RHS cannot draw from multiple differing pattern matches. This would be an error.<br />
<br />
<haskell><br />
-- this would be a scoping error<br />
eitherSum :: Either Int Int -> Int<br />
eitherSum eitherVal case eitherVal of<br />
Left l, Right r -> l + r<br />
</haskell><br />
<br />
An additional example:<br />
<haskell><br />
-- modified example from Haskell School of Music<br />
getDur :: Primitive a -> Dur<br />
getDur p = case p of<br />
ModDur (Tempo r) d -> d / r<br />
Note d _, Rest d, ModDur _ d -> d <br />
-- notice how we don't have to write `-> d` for<br />
-- each of the 3 trivial cases; they all share the same RHS<br />
<br />
-- layout rules should also permit<br />
-- splitting the shared matches over multiple lines<br />
getDur' :: Primitive a -> Dur<br />
getDur' p = case p of<br />
ModDur (Tempo r) d -> d / r<br />
Note d _,<br />
Rest d,<br />
ModDur _ d -> d<br />
</haskell></div>Drb226https://wiki.haskell.org/IRC_channelIRC channel2011-09-27T01:02:00Z<p>Drb226: /* Logs */ ircbrowse is a broken link</p>
<hr />
<div>Internet Relay Chat is a worldwide text chat service with many thousands<br />
of users among various irc networks.<br />
<br />
The Freenode IRC network hosts the very large #haskell channel, and we've had<br />
up to <br />
804<br />
concurrent users<br />
(average is 714<br />
), making the channel<br />
[http://searchirc.com/search.php?SCHANS=1&SSORT=SIZE&N=freenode one of the 10 largest]<br />
of the 12,000+ channels on freenode and the second largest programming language channel after Python. One famous<br />
resident is [[Lambdabot]], another is [http://hpaste.org hpaste] (see<br />
the [[#Bots|Bots]] section below).<br />
<br />
The IRC channel can be an excellent place to learn more about Haskell,<br />
and to just keep in the loop on new things in the Haskell world. Many<br />
new developments in the Haskell world first appear on the irc channel.<br />
<br />
Since 2009, the Haskell channel has grown large enough that we've split it in two parts:<br />
<br />
* #haskell, for all the usual things<br />
* #haskell-in-depth , for those seeking in depth, or more theoretical discussion<br />
<br />
As always, #haskell remains the primary place for new user questions.<br />
<br />
--------------------------<br />
<br />
[http://haskell.org/sitewiki/images/3/3c/Haskell-current.png [[Image:Haskell-current-small.png|thumb|The #haskell social graph, Jan 2008]]]<br />
<br />
[[Image:Irc-raw.png|thumb|Daily traffic in #haskell since 2004]]<br />
<br />
[[Image:Nick-activity.png|thumb|Growth of #haskell]]<br />
<br />
[[Image:Haskell-wordle-irc.png|thumb|Haskell noun map]]<br />
<br />
== Getting there ==<br />
<br />
If you point your irc client to [irc://chat.freenode.net/haskell chat.freenode.net] and then join the #haskell channel, you'll be there. Alternately, you can try http://java.freenode.net/ or http://webchat.freenode.net/ which connects inside the browser.<br />
<br />
Example, using [http://www.irssi.org/ irssi]:<br />
<br />
$ irssi -c chat.freenode.net -n myname -w mypassword<br />
/join #haskell<br />
<br />
Tip, if you're using Emacs to edit your Haskell sources then why not use it to chat about Haskell? Check out [http://www.emacswiki.org/cgi-bin/wiki/EmacsIRCClient ERC], The Emacs IRC client. Invoke it like this and follow the commands:<br />
<br />
M-x erc-select<br />
...<br />
/join #haskell<br />
<br />
[[Image:Irc--haskell-screenshot.png|frame|A screenshot of an irssi session in #haskell]]<br />
<br />
== Principles ==<br />
<br />
The #haskell channel is a very friendly, welcoming place to hang out,<br />
teach and learn. The goal of #haskell is to encourage learning and<br />
discussion of Haskell, functional programming, and programming in<br />
general. As part of this we welcome newbies, and encourage teaching of<br />
the language.<br />
<br />
Part of the #haskell success comes from the approach that the community<br />
is quite tight knit -- we know each other -- it's not just a homework<br />
channel. As a result, many collaborative projects have arisen between<br />
Haskell irc channel citizens.<br />
<br />
To maintain the friendly, open culture, the following is required:<br />
<br />
* Low to zero tolerance for ridiculing questions. Insulting new users is unacceptable.<br />
<br />
New Haskell users should feel entirely comfortable asking new questions.<br />
Helpful answers should be encouraged with <hask>name++</hask> karma<br />
points, in public, as a reward for providing a good answer.<br />
<br />
As the channel grows, we see a diverse range of people, with different<br />
programming backgrounds, trying to make their way with Haskell. A good<br />
rule of thumb, to avoid frustration is:<br />
<br />
* approach negative comments by asking for details (kind of like [http://en.wikipedia.org/wiki/Socratic_method Socratic questioning]), rather than challenging the competence of the writer (ad hominem).<br />
<br />
<br />
== History ==<br />
<br />
The #haskell channel appeared in the late 90s, and really got going<br />
in early 2001, with the help of Shae Erisson (aka shapr).<br />
<br />
A fairly extensive analysis of the traffic on #haskell over the years is<br />
[http://www.cse.unsw.edu.au/~dons/irc/ kept here]<br />
<br />
== Related channels ==<br />
<br />
In addition to the main Haskell channel there are also:<br />
<br />
{| border="1" cellspacing="0" cellpadding="5" align="center"<br />
! Channel<br />
! Purpose<br />
|-<br />
| #haskell.cz<br />
| Czech speakers (UTF-8)<br />
|- <br />
| #haskell.de<br />
| German speakers<br />
|-<br />
| #haskell.dut<br />
| Dutch speakers<br />
|-<br />
| #haskell.es<br />
| Spanish speakers<br />
|-<br />
| #haskell.fi<br />
| Finnish speakers<br />
|-<br />
| #haskell-fr (note the hyphen!)<br />
| French speakers <br />
|-<br />
| #haskell.hr<br />
| Croatian speakers<br />
|-<br />
| #haskell.it <br />
| Italian speakers<br />
|-<br />
| #haskell.jp <br />
| Japanese speakers<br />
|-<br />
| #haskell.no <br />
| Norwegian speakers<br />
|-<br />
| #haskell.pt<br />
| Portuguese speakers<br />
|-<br />
| #haskell.ru <br />
| Russian speakers. Seems that most of them migrated to Jabber conference (haskell@conference.jabber.ru).<br />
|-<br />
| #haskell_ru <br />
| Russian speakers again, in UTF-8. For those, who prefer good ol' IRC channel with a lambdabot.<br />
|-<br />
| #haskell.se <br />
| Swedish speakers<br />
|-<br />
| #haskell-blah <br />
| Haskell people talking about anything except Haskell itself<br />
|-<br />
| #haskell-books <br />
| Authors organizing the collaborative writing of the [http://en.wikibooks.org/wiki/Haskell Haskell wikibook] and other books or tutorials.<br />
|-<br />
| #haskell-game<br />
| The hub for Haskell-based [[Game Development|game development]]<br />
|-<br />
| #haskell-in-depth<br />
| slower paced discussion of use, theory, implementation etc with no monad tutorials!<br />
|-<br />
| #haskell-iphone<br />
| Haskell-based [[iPhone]] development<br />
|-<br />
| #haskell-overflow<br />
| Overflow conversations<br />
|-<br />
| #haskell-web<br />
| Friendly, practical discussion of haskell web app/framework/server development<br />
|-<br />
| '''Platform-specific:'''<br />
|<br />
|-<br />
| #arch-haskell <br />
| [[Arch Linux]]/ specific Haskell conversations<br />
|-<br />
| #gentoo-haskell <br />
| [[Gentoo]]/Linux specific Haskell conversations<br />
|-<br />
| '''Projects using haskell:'''<br />
|<br />
|-<br />
| #darcs <br />
| [[Darcs]] revision control system<br />
|-<br />
| #hackage<br />
| Haskell's software distribution infrastructure<br />
|-<br />
| #happs<br />
| [http://happstack.com Happstack] web framework<br />
|-<br />
| #hledger<br />
| [http://hledger.org hledger] accounting tools and library<br />
|-<br />
| #leksah<br />
| [http://leksah.org Leksah] IDE for Haskell development<br />
|-<br />
| #perl6 <br />
| [http://www.pugscode.org Perl 6] development (plenty of Haskell chat there too)<br />
|-<br />
| #snapframework<br />
| [http://snapframework.com/ Snap] web framework<br />
|-<br />
| #xmonad<br />
| [http://xmonad.org Xmonad] tiling window manager<br />
|}<br />
<br />
== Logs ==<br />
<br />
'''Logs''' are kept at http://tunes.org/~nef/logs/haskell/<br />
<br />
<!-- anywhere else? ircbrowse.com is a goner, apparently --><br />
<br />
== Bots ==<br />
<br />
There are various bots on the channel. Their names and usage are described here.<br />
<br />
=== lambdabot ===<br />
<br />
[[Lambdabot]] is both the name of a software package and a bot on the channel. It provides many useful services for visitors to the IRC channel. It is available as a haskell package and can be integrated into ghci. Details on the software are found on a [[Lambdabot|separate wiki page]].<br />
<br />
Here is its interface for the IRC user:<br />
<br />
lambdabot's commands are prepended by a '@' sign.<br />
<br />
{| border="1" cellspacing="0" cellpadding="5" align="center"<br />
! Command<br />
! Usage<br />
|-<br />
| @help<br />
| display help to other commands, but help text is not available for all commands.<br />
|-<br />
| @type EXPR or ':t' EXPR<br />
| shows the type of an expression<br />
|-<br />
| @kind TYPECONSTRUCTOR<br />
| shows the kind of a type constructor<br />
|-<br />
| @run EXPR or '>' EXPR<br />
| evaluates EXPR<br />
|-<br />
| @pl FUNCTION<br />
| shows a [[pointfree]] version of FUNCTION<br />
|-<br />
| @pointful FUNCTION or '@unpl' FUNCTION<br />
| shows a 'pointful' version of FUNCTION<br />
|}<br />
<br />
=== preflex ===<br />
<br />
is the name of a lambdabot with more commands/plugins enabled. It is run by ?? To talk to preflex, write <tt>preflex: command ARGS</tt><br />
<br />
{| border="1" cellspacing="0" cellpadding="5" align="center"<br />
! Command<br />
! Usage<br />
|-<br />
| help COMMAND<br />
| displays help to other commands.<br />
|-<br />
| list<br />
| lists all plugins with their commands<br />
|-<br />
| NICK++ / NICK--<br />
| in/decrements the karma of NICK.<br />
|-<br />
| karma NICK<br />
| shows the karma of NICK<br />
|-<br />
| seen NICK<br />
| shows information about the last message of a user<br />
|-<br />
| tell / ask<br />
| sends NICK MSG a message when she becomes active.<br />
|-<br />
| xseen<br />
| ''see 'seen' ?? any difference ?''<br />
|-<br />
| quote NICK<br />
| prints a random quote of NICK<br />
|-<br />
| remember NAME QUOTE<br />
| associates NAME with quote. can be accessed by 'quote'<br />
|-<br />
| ...<br />
| ...<br />
|}<br />
<br />
=== hpaste ===<br />
The hpaste bot provides a notification interface to the [http://hpaste.org hpaste pastebin]. [[Hpaste.el|Emacs integration]] is available.<br />
<br />
''Usage?''<br />
<br />
''Not online often !? ''<br />
<br />
=== hackage ===<br />
The hackage bot provides real-time notifications of new package uploads to [http://hackage.haskell.org Hackage].<br />
<br />
== Locations ==<br />
<br />
To get an overview of where everybody on the channel might<br />
be, physically, please visit [[Haskell user locations]].<br />
<br />
<br />
[[Category:Community]]</div>Drb226https://wiki.haskell.org/Haskell2010Haskell20102011-09-23T18:45:14Z<p>Drb226: redirect instead</p>
<hr />
<div>#REDIRECT [[Haskell 2010]]</div>Drb226https://wiki.haskell.org/Haskell2010Haskell20102011-09-23T18:42:10Z<p>Drb226: creating page</p>
<hr />
<div>See [http://www.haskell.org/onlinereport/haskell2010/ Haskell 2010 online report] or the [http://www.haskell.org/definition/haskell2010.pdf Haskell 2010 pdf version]</div>Drb226https://wiki.haskell.org/JobsJobs2010-12-23T03:24:33Z<p>Drb226: adding haskellers</p>
<hr />
<div>This page collects advertisements for commercial and academic positions involving Haskell or related technologies. <br />
<br />
If you are seeking Haskell jobs, or wish to recruit, good places to follow are the Haskell and Haskell-cafe mailing lists, the [http://cufp.org/jobs CUFP Job Opportunities list] and the Types mailing list (particularly for research jobs). Contacting those organisations listed on the [[Haskell in industry]] is a good idea. Joining the nascent networking site [http://haskellers.com Haskellers] may also prove beneficial.<br />
<br />
Please also supply the date when you add a new job opening to the list below.<br />
<br />
==Industry positions==<br />
<br />
*[http://www.aetion.com/ Aetion Technologies LLC]<br />
*[http://www.bluespec.com/about/careers.htm Bluespec, Inc.]<br />
*[http://www.galois.com/company/careers Galois, Inc]<br />
*[http://www.starling-software.com/en/employment/ Starling Software K.K.]<br />
*[http://www.tsurucapital.com/en/ Tsuru Capital LLC] <br />
<br />
<br />
===Related positions===<br />
* [http://www.erlang-solutions.com/jobs/ Erlang Solutions]<br />
* [https://www.epos-asp.dk/hosting/simcorp/recruit.asp?jobListId=3&titleid=392&lang=en SimCorp is looking for Ocaml Software Developers]<br />
<br />
==Academic positions==<br />
* [http://cufp.org/jobs/programming-languages-researcher-haskell-expertise] Programming Languages Researcher with Haskell Expertise (added Sep 2010)<br />
<br />
==PhD/MSc Studentships==<br />
<br />
<br />
==Internships==<br />
<br />
* [http://hackage.haskell.org/trac/ghc/wiki/Internships Internships on Haskell and GHC, at Microsoft Research, Cambridge]<br />
* [http://www.haskellers.com/jobs/5/ Spring Internship at Intel to develop EDSL for parallel vector computation] (added Nov 2010)<br />
<br />
[[Category:Community]]</div>Drb226https://wiki.haskell.org/99_questions/Solutions/6399 questions/Solutions/632010-11-22T07:05:15Z<p>Drb226: Add short explanation of first implementation</p>
<hr />
<div>Construct a complete binary tree<br />
<br />
A complete binary tree with height H is defined as follows:<br />
* The levels 1,2,3,...,H-1 contain the maximum number of nodes (i.e 2**(i-1) at the level i)<br />
* In level H, which may contain less than the maximum possible number of nodes, all the nodes are "left-adjusted". This means that in a levelorder tree traversal all internal nodes come first, the leaves come second, and empty successors (the nil's which are not really nodes!) come last. <br />
<br />
Particularly, complete binary trees are used as data structures (or addressing schemes) for heaps. <br />
<br />
We can assign an address number to each node in a complete binary tree by enumerating the nodes in level-order, starting at the root with number 1. For every node X with address A the following property holds: The address of X's left and right successors are 2*A and 2*A+1, respectively, if they exist. This fact can be used to elegantly construct a complete binary tree structure.<br />
<br />
Write a predicate complete_binary_tree/2.<br />
<br />
<haskell><br />
import Data.List <br />
<br />
data Tree a = Empty | Branch a (Tree a) (Tree a) <br />
deriving (Show, Eq) <br />
<br />
filled :: Tree a -> [[Bool]] <br />
filled Empty = repeat [False] <br />
filled (Branch _ l r) = [True] : zipWith (++) (filled l) (filled r) <br />
<br />
complete_binary_tree :: Int -> Tree Char <br />
complete_binary_tree n = generate_tree 1 <br />
where generate_tree x <br />
| x > n = Empty <br />
| otherwise = Branch 'x' (generate_tree (2*x) ) <br />
(generate_tree (2*x+1)) <br />
<br />
is_complete_binary_tree :: Tree a -> Bool <br />
is_complete_binary_tree Empty = True <br />
is_complete_binary_tree t = and $ last_proper : zipWith (==) lengths powers <br />
where levels = takeWhile or $ filled t <br />
-- The upper levels of the tree should be filled. <br />
-- Every level has twice the number of nodes as the one above it, <br />
-- so [1,2,4,8,16,...] <br />
lengths = map (length . filter id) $ init levels <br />
powers = iterate (2*) 1 <br />
-- The last level should contain a number of filled spots, <br />
-- and (maybe) some empty spots, but no filled spots after that! <br />
last_filled = map head $ group $ last levels <br />
last_proper = head last_filled && (length last_filled) < 3 <br />
</haskell><br />
The "generate_tree" method here creates Node number "x", and then creates x's children nodes. By the property described above, these nodes are numbers 2*x and 2*x+1. If x > n, then the node is only created as Empty, and does not create children nodes.<br />
----<br />
Alternative solution which constructs complete binary trees from a given list using local recursion (also includes a lookup function as per the Prolog solution):<br />
<haskell><br />
completeBinaryTree :: Int -> a -> Tree a<br />
completeBinaryTree n = cbtFromList . replicate n<br />
<br />
cbtFromList :: [a] -> Tree a<br />
cbtFromList xs = let (t, xss) = cbt (xs:xss) in t<br />
where cbt ((x:xs):xss) =<br />
let (l, xss') = cbt xss<br />
(r, xss'') = cbt xss'<br />
in (Branch x l r, xs:xss'')<br />
cbt _ = (Empty, [])<br />
<br />
lookupIndex :: Tree a -> Integer -> a<br />
lookupIndex t = lookup t . path<br />
where lookup Empty _ = error "index to large"<br />
lookup (Branch x _ _) [] = x<br />
lookup (Branch x l r) (p:ps) = lookup (if even p then l else r) ps<br />
<br />
path = reverse . takeWhile (>1) . iterate (`div` 2) . (1+)<br />
</haskell></div>Drb226https://wiki.haskell.org/99_questions/Solutions/62B99 questions/Solutions/62B2010-11-22T06:35:48Z<p>Drb226: rewrite a little shorter and (imho) clearer</p>
<hr />
<div>Collect the nodes at a given level in a list<br />
<br />
A node of a binary tree is at level N if the path from the root to the node has length N-1. The root node is at level 1. Write a predicate atlevel/3 to collect all nodes at a given level in a list. <br />
<br />
<haskell><br />
atlevel :: Tree a -> Int -> [a]<br />
atlevel Empty _ = []<br />
atlevel (Branch v l r) n<br />
| n == 1 = [v]<br />
| n > 1 = atlevel l (n-1) ++ atlevel r (n-1)<br />
| otherwise = []<br />
</haskell><br />
<br />
Another possibility is to decompose the problem:<br />
<br />
<haskell><br />
levels :: Tree a -> [[a]]<br />
levels Empty = repeat []<br />
levels (Branch a l r) = [a] : zipWith (++) (levels l) (levels r)<br />
<br />
atlevel :: Tree a -> Int -> [a]<br />
atlevel t n = levels t !! (n-1)<br />
</haskell></div>Drb226https://wiki.haskell.org/99_questions/Solutions/5599 questions/Solutions/552010-11-21T08:17:02Z<p>Drb226: adding another way: make all combinations and then filter</p>
<hr />
<div>(**) Construct completely balanced binary trees<br />
<br />
In a completely balanced binary tree, the following property holds for every node: The number of nodes in its left subtree and the number of nodes in its right subtree are almost equal, which means their difference is not greater than one.<br />
<br />
Write a function cbal-tree to construct completely balanced binary trees for a given number of nodes. The predicate should generate all solutions via backtracking. Put the letter 'x' as information into all nodes of the tree.<br />
<br />
<haskell><br />
cbalTree :: Int -> [Tree Char]<br />
cbalTree 0 = [Empty]<br />
cbalTree n = let (q, r) = (n - 1) `quotRem` 2<br />
in [Branch 'x' left right | i <- [q .. q + r],<br />
left <- cbalTree i,<br />
right <- cbalTree (n - i - 1)]<br />
</haskell><br />
<br />
This solution uses a list comprehension to enumerate all the trees, in a style that is more natural than standard backtracking.<br />
<br />
The base case is a tree of size 0, for which <tt>Empty</tt> is the only possibility. Trees of size <tt>n == 1</tt> or larger consist of a branch, having left and right subtrees with sizes that sum up to <tt>n - 1</tt>. This is accomplished by getting the quotient and remainder of <tt>(n - 1)</tt> divided by two; the remainder will be 0 if <tt>n</tt> is odd, and 1 if <tt>n</tt> is even. For <tt>n == 4</tt>, <tt>(q, r) = (1, 1)</tt>.<br />
<br />
Inside the list comprehension, <tt>i</tt> varies from <tt>q</tt> to <tt>q + r</tt>. In our <tt>n == 4</tt> example, <tt>i</tt> will vary from 1 to 2. We recursively get all possible left subtrees of size <tt>[1..2]</tt>, and all right subtrees with the remaining elements.<br />
<br />
When we recursively call <tt>cbalTree 1</tt>, <tt>q</tt> and <tt>r</tt> will both be 0, thus <tt>i</tt> will be 0, and the left subtree will simply be <tt>Empty</tt>. The same goes for the right subtree, since <tt>n - i - 1</tt> is 0. This gives back a branch with no children--a "leaf" node:<br />
<br />
<haskell><br />
> cbalTree 1<br />
[Branch 'x' Empty Empty]<br />
</haskell><br />
<br />
The call to <tt>cbalTree 2</tt> sets <tt>(q, r) = (0, 1)</tt>, so we'll get back a list of two possible subtrees. One has an empty left branch, the other an empty right branch:<br />
<br />
<haskell><br />
> cbalTree 2<br />
[<br />
Branch 'x' Empty (Branch 'x' Empty Empty),<br />
Branch 'x' (Branch 'x' Empty Empty) Empty<br />
]<br />
</haskell><br />
<br />
In this way, balances trees of any size can be built recursively from smaller trees.<br />
<br />
----<br />
Another approach is to create a list of all possible tree structures with a given number of nodes, and then filter that list on whether or not the tree is balanced.<br />
<br />
<haskell><br />
data Tree a = Empty | Branch a (Tree a) (Tree a) deriving (Show, Eq)<br />
leaf x = Branch x Empty Empty<br />
<br />
main = putStrLn $ concatMap (\t -> show t ++ "\n") balTrees<br />
where balTrees = filter isBalancedTree (makeTrees 'x' 4)<br />
<br />
isBalancedTree :: Tree a -> Bool<br />
isBlanacedTree Empty = True<br />
isBalancedTree (Branch _ l r) = abs (countBranches l - countBranches r) ≤ 1<br />
&& isBalancedTree l && isBalancedTree r<br />
isBalancedTree _ = False<br />
<br />
countBranches :: Tree a -> Int<br />
countBranches Empty = 0<br />
countBranches (Branch _ l r) = 1 + countBranches l + countBranches r<br />
<br />
-- makes all possible trees filled with the given number of nodes<br />
-- and fill them with the given value<br />
makeTrees :: a -> Int -> [Tree a]<br />
makeTrees _ 0 = []<br />
makeTrees c 1 = [leaf c]<br />
makeTrees c n = lonly ++ ronly ++ landr<br />
where lonly = [Branch c t Empty | t <- smallerTree]<br />
ronly = [Branch c Empty t | t <- smallerTree]<br />
landr = concat [[Branch c l r | l <- fst lrtrees, r <- snd lrtrees] | lrtrees <- treeMinusTwo]<br />
smallerTree = makeTrees c (n-1)<br />
treeMinusTwo = [(makeTrees c num, makeTrees c (n-1-num)) | num <- [0..n-2]]<br />
</haskell><br />
<br />
While not nearly as neat as the previous solution, this solution uses some generic binary tree methods that could be useful in other contexts.</div>Drb226https://wiki.haskell.org/99_questions/Solutions/4699 questions/Solutions/462010-11-21T06:07:37Z<p>Drb226: note on generalizing 'table' method</p>
<hr />
<div>(**) Define predicates and/2, or/2, nand/2, nor/2, xor/2, impl/2 and equ/2 (for logical equivalence) which succeed or fail according to the result of their respective operations; e.g. and(A,B) will succeed, if and only if both A and B succeed.<br />
<br />
A logical expression in two variables can then be written as in the following example: and(or(A,B),nand(A,B)).<br />
<br />
Now, write a predicate table/3 which prints the truth table of a given logical expression in two variables.<br />
<br />
The first step in this problem is to define the Boolean predicates:<br />
<br />
<haskell><br />
-- NOT negates a single Boolean argument<br />
not' :: Bool -> Bool<br />
not' True = False<br />
not' False = True<br />
<br />
-- Type signature for remaining logic functions<br />
and',or',nor',nand',xor',impl',equ' :: Bool -> Bool -> Bool<br />
<br />
-- AND is True if both a and b are True<br />
and' True True = True<br />
and' _ _ = False<br />
<br />
-- OR is True if a or b or both are True<br />
or' False False = False<br />
or' _ _ = True<br />
<br />
-- NOR is the negation of 'or'<br />
nor' a b = not' $ or' a b<br />
<br />
-- NAND is the negation of 'and'<br />
nand' a b = not' $ and' a b<br />
<br />
-- XOR is True if either a or b is True, but not if both are True<br />
xor' True False = True<br />
xor' False True = True<br />
xor' _ _ = False<br />
<br />
-- IMPL is True if a implies b, equivalent to (not a) or (b)<br />
impl' a b = (not' a) `or'` b<br />
<br />
-- EQU is True if a and b are equal<br />
equ' True True = True<br />
equ' False False = True<br />
equ' _ _ = False<br />
</haskell><br />
<br />
The above implementations build each logic function from scratch; they could be shortened using Haskell's builtin equivalents:<br />
<br />
<haskell><br />
and' a b = a && b<br />
or' a b = a || b<br />
nand' a b = not (and' a b)<br />
nor' a b = not (or' a b)<br />
xor' a b = and' (or' a b) (nand' a b)<br />
impl' a b = or' (not a) b<br />
equ' a b = a == b<br />
</haskell><br />
<br />
Some could be reduced even further using [[Pointfree]] style:<br />
<br />
<haskell><br />
and' = (&&)<br />
or' = (||)<br />
equ' = (==)<br />
</haskell><br />
<br />
The only remaining task is to generate the truth table; most of the complexity here comes from the string conversion and IO. The approach used here accepts a Boolean function <tt>(Bool -> Bool -> Bool)</tt>, then calls that function with all four combinations of two Boolean values, and converts the resulting values into a list of space-separated strings. Finally, the strings are printed out by mapping <hask>putStrLn</hask> across the list of strings:<br />
<br />
<haskell><br />
table :: (Bool -> Bool -> Bool) -> IO ()<br />
table f = mapM_ putStrLn [show a ++ " " ++ show b ++ " " ++ show (f a b)<br />
| a <- [True, False], b <- [True, False]]<br />
</haskell><br />
<br />
The table function in Lisp supposedly uses Lisp's symbol handling to substitute variables on the fly in the expression. I chose passing a binary function instead because parsing an expression would be more verbose in haskell than it is in Lisp. Template Haskell could also be used :)<br />
<br />
The table function can be generalized to work for any given binary function and domain.<br />
<haskell><br />
table :: (Bool -> Bool -> Bool) -> String<br />
table f = printBinary f [True, False]<br />
<br />
printBinary :: (Show a, Show b) => (a -> a -> b) -> [a] -> String<br />
printBinary f domain = concatMap (++ "\n") [printBinaryInstance f x y | x <- domain, y <- domain]<br />
<br />
printBinaryInstance :: (Show a, Show b) => (a -> a -> b) -> a -> a -> String<br />
printBinaryInstance f x y = show x ++ " " ++ show y ++ " " ++ show (f x y)<br />
</haskell></div>Drb226https://wiki.haskell.org/99_questions/Solutions/3199 questions/Solutions/312010-11-21T03:30:11Z<p>Drb226: replace symbols with code</p>
<hr />
<div>(**) Determine whether a given integer number is prime.<br />
<br />
<haskell><br />
isPrime :: Integral a => a -> Bool<br />
isPrime p = p > 1 && (all (\n -> p `mod` n /= 0 ) $ takeWhile (\n -> n*n <= p) [2..])<br />
</haskell><br />
<br />
Well, a natural number p is a prime number iff it is larger than 1 and no natural number n with n >= 2 and n^2 <= p is a divisor of p. That's exactly what is implemented: we take the list of all integral numbers starting with 2 as long as their square is at most p and check that for all these n there is a remainder concerning the division of p by n.<br />
<br />
However, we don't actually need to check all natural numbers <= sqrt P. We need only check the all natural primes <= sqrt P.<br />
<br />
<haskell><br />
-- Infinite list of all prime numbers<br />
allPrimes :: [Int]<br />
allPrimes = filter (isPrime) [2..]<br />
<br />
isPrime :: Int -> Bool<br />
isPrime p<br />
| p < 2 = error "Number too small"<br />
| p == 2 = True<br />
| p > 2 = all (\n -> p `mod` n /= 0) (getPrimes sqrtp)<br />
where getPrimes z = takeWhile (<= z) allPrimes<br />
sqrtp = floor . sqrt $ fromIntegral p<br />
</haskell><br />
<br />
Note that the mutual dependency of allPrimes and isPrime would result in an infinite loop if we weren't careful. But since we limit our observation of allPrimes to <= sqrt x, we avoid infinite recursion.<br />
<br />
While the mutual dependency is interesting, this second version is not necessarily more efficient than the first. Though we avoid checking all natural numbers <= sqrt P in the isPrime method, we instead check the primality of all natural numbers <= sqrt P in the allPrimes definition.</div>Drb226https://wiki.haskell.org/99_questions/Solutions/3199 questions/Solutions/312010-11-21T03:28:31Z<p>Drb226: adding an interesting variant</p>
<hr />
<div>(**) Determine whether a given integer number is prime.<br />
<br />
<haskell><br />
isPrime :: Integral a => a -> Bool<br />
isPrime p = p > 1 && (all (\n -> p `mod` n /= 0 ) $ takeWhile (\n -> n*n <= p) [2..])<br />
</haskell><br />
<br />
Well, a natural number p is a prime number iff it is larger than 1 and no natural number n with n >= 2 and n^2 <= p is a divisor of p. That's exactly what is implemented: we take the list of all integral numbers starting with 2 as long as their square is at most p and check that for all these n there is a remainder concerning the division of p by n.<br />
<br />
However, we don't actually need to check all natural numbers <= sqrt P. We need only check the all natural primes <= sqrt P.<br />
<br />
<haskell><br />
-- Infinite list of all prime numbers<br />
allPrimes :: [Int]<br />
allPrimes = filter (isPrime) [2..]<br />
<br />
isPrime :: Int -> Bool<br />
isPrime p<br />
| p < 2 = error "Number too small"<br />
| p ≡ 2 = True<br />
| p > 2 = all (\n -> p `mod` n /= 0) (getPrimes sqrtp)<br />
where getPrimes z = takeWhile (≤ z) allPrimes<br />
sqrtp = floor∘sqrt $ fromIntegral p<br />
</haskell><br />
<br />
Note that the mutual dependency of allPrimes and isPrime would result in an infinite loop if we weren't careful. But since we limit our observation of allPrimes to <= sqrt x, we avoid infinite recursion.<br />
<br />
While the mutual dependency is interesting, this second version is not necessarily more efficient than the first. Though we avoid checking all natural numbers <= sqrt P in the isPrime method, we instead check the primality of all natural numbers <= sqrt P in the allPrimes definition.</div>Drb226https://wiki.haskell.org/99_questions/Solutions/2499 questions/Solutions/242010-11-20T05:56:06Z<p>Drb226: </p>
<hr />
<div>Lotto: Draw N different random numbers from the set 1..M.<br />
<br />
<haskell><br />
import System.Random<br />
diff_select :: Int -> Int -> IO [Int]<br />
diff_select n to = diff_select' n [1..to]<br />
<br />
diff_select' 0 _ = return []<br />
diff_select' _ [] = error "too few elements to choose from"<br />
diff_select' n xs = do r <- randomRIO (0,(length xs)-1)<br />
let remaining = take r xs ++ drop (r+1) xs<br />
rest <- diff_select' (n-1) remaining<br />
return ((xs!!r) : rest)<br />
</haskell><br />
<br />
The random numbers have to be distinct!<br />
<br />
In order to use randomRIO here, we need import module System.Random.<br />
<br />
As can be seen, having implemented problem 23, rnd_select, the solution is trivial.<br />
<haskell><br />
diff_select n to = rnd_select [1..to] n<br />
</haskell></div>Drb226https://wiki.haskell.org/99_questions/Solutions/2299 questions/Solutions/222010-11-20T05:22:36Z<p>Drb226: slightly modified the version with guards so that it will make backwards ranges too</p>
<hr />
<div>Create a list containing all integers within a given range.<br />
<br />
<haskell><br />
range x y = [x..y]<br />
</haskell><br />
or<br />
<haskell><br />
range = enumFromTo<br />
</haskell><br />
or<br />
<haskell><br />
range x y = take (y-x+1) $ iterate (+1) x<br />
</haskell><br />
or<br />
<haskell><br />
range start stop<br />
| start > stop = reverse (range stop start)<br />
| start == stop = [stop]<br />
| start < stop = start:range (start+1) stop<br />
</haskell><br />
<br />
Since there's already syntactic sugar for ranges, there's usually no reason to define a function like 'range' in Haskell. In fact, the syntactic sugar is implemented using the enumFromTo function, which is exactly what 'range' should be.</div>Drb226https://wiki.haskell.org/99_questions/Solutions/1999 questions/Solutions/192010-11-20T04:54:14Z<p>Drb226: </p>
<hr />
<div>(**) Rotate a list N places to the left.<br />
<br />
Hint: Use the predefined functions length and (++).<br />
<br />
<haskell><br />
rotate [] _ = []<br />
rotate l 0 = l<br />
rotate (x:xs) (n+1) = rotate (xs ++ [x]) n<br />
rotate l n = rotate l (length l + n)<br />
</haskell><br />
<br />
There are two separate cases:<br />
* If n > 0, move the first element to the end of the list n times.<br />
* If n < 0, convert the problem to the equivalent problem for n > 0 by adding the list's length to n.<br />
<br />
or using cycle:<br />
<haskell><br />
rotate xs n = take len . drop (n `mod` len) . cycle $ xs<br />
where len = length xs<br />
</haskell><br />
<br />
or<br />
<br />
<haskell><br />
rotate xs n = if n >= 0 then<br />
drop n xs ++ take n xs<br />
else let l = ((length xs) + n) in<br />
drop l xs ++ take l xs<br />
</haskell><br />
<br />
or<br />
<br />
<haskell><br />
rotate xs n = drop nn xs ++ take nn xs<br />
where <br />
nn = n `mod` length xs<br />
</haskell><br />
<br />
Using a simple splitAt trick<br />
<haskell><br />
rotate xs n<br />
| n < 0 = rotate xs (n+len)<br />
| n > len = rotate xs (n-len)<br />
| otherwise = let (f,s) = splitAt n xs in s ++ f<br />
where len = length xs<br />
</haskell></div>Drb226https://wiki.haskell.org/99_questions/Solutions/499 questions/Solutions/42010-11-20T01:39:54Z<p>Drb226: correction (foldl) and shortened version of foldr</p>
<hr />
<div>(*) Find the number of elements of a list.<br />
<br />
<haskell><br />
myLength :: [a] -> Int<br />
myLength [] = 0<br />
myLength (_:xs) = 1 + myLength xs<br />
</haskell><br />
<br />
<haskell><br />
myLength' = foldl (\n _ -> n + 1) 0<br />
myLength'' = foldr (\_ n -> n + 1) 0<br />
myLength''' = foldr (\_ -> (+1)) 0<br />
</haskell><br />
<br />
This is <hask>length</hask> in <hask>Prelude</hask>.</div>Drb226