https://wiki.haskell.org/api.php?action=feedcontributions&user=Erik+Hesselink&feedformat=atomHaskellWiki - User contributions [en]2021-02-25T17:17:01ZUser contributionsMediaWiki 1.27.4https://wiki.haskell.org/index.php?title=Reactive-banana&diff=60298Reactive-banana2015-10-29T16:27:56Z<p>Erik Hesselink: Fix github link: no develop branch anymore.</p>
<hr />
<div>== What is it? ==<br />
<br />
<div style="float:left;"><br />
[[Image:Reactive-Banana-banana.png|Reactive banana displaying trigger-happy <code>Behavior</code>.]]</div><br />
''Reactive-banana'' is a library for [[Functional Reactive Programming]] (FRP).<br />
<br />
FRP offers an elegant and concise way to express interactive programs such as [http://hackage.haskell.org/package/reactive-banana-wx graphical] [https://wiki.haskell.org/Threepenny-gui user] interfaces, animations, [[Reactive-balsa|computer music]] or robot controllers. In particular, it promises to avoid the spaghetti code that is all too common in traditional approaches to GUI programming.<br />
<br />
The goal of the library is to provide a solid foundation.<br />
* Programmers interested implementing FRP will have a '''reference''' for a '''simple semantics''' with a working implementation. The library stays close to the semantics pioneered by Conal Elliott.<br />
* The library features an '''efficient implementation'''. No more spooky time leaks, predicting space & time usage should be straightforward.<br />
* A plethora of [[#documentation|example code]] helps with getting started.<br />
<br />
The library is meant to be used in conjunction with existing libraries that are specific to your problem domain. For instance, you can hook it into ''any'' event-based GUI framework, like [[wxHaskell]] or [[Gtk2Hs]]. Several helper packages like {{HackagePackage|id=reactive-banana-wx}} provide a small amount of glue code that can make life easier.<br />
<br />
[[#feedback|Feedback]] is welcome, I want to hear from you!<br />
<br />
== Status ==<br />
<br />
Current development focuses on performance. Applications to GUI programming are explored in the sister project [[Threepenny-gui|threepenny-gui]].<br />
<br />
* 29 October 2015: reactive-banana 1.0.0.0 released. Milestone.<br />
* 27 August 2015: reactive-banana 0.9.0.0 released.<br />
* 29 January 2014: reactive-banana 0.8.0.0 released.<br />
* 21 November 2013: reactive-threepenny-gui deprecated again, because [[Threepenny-gui|threepenny-gui]] now has its own FRP subsystem built-in.<br />
* 02 August 2013: Initial release of reactive-banana-threepenny. Binds to the threepenny-gui GUI library.<br />
* 26 August 2012: reactive-banana 0.7.0.0 released. Features dynamic event switching.<br />
* 15 May 2012: reactive-banana 0.6.0.0 released.<br />
* 25 March 2012: reactive-banana 0.5.0.0 released.<br />
* 24 October 2011: reactive-banana 0.4.3.0 released.<br />
* 26 September 2011: Added some more examples, reactive-banana 0.4.2.0 released.<br />
* 14 July 2011: Implemented many examples, reactive-banana 0.4.1.0 released.<br />
* 22 June 2011: reactive-banana 0.3.0.0 released<br />
* 28 April 2011: reactive-banana 0.2.0.0 released<br />
<br />
== Fake Testimonials ==<br />
<br />
"In the programming-language world, one rule of survival is simple: dance or die. This library makes dancing easy." – ''Simon Banana Jones''<br />
<br />
"About the use of language: it is impossible to sharpen a pencil with a blunt axe. You should try reactive-banana instead." — ''Event Dijkstra''<br />
<br />
"When I need a <code>bullet</code> event, I can just trigger it." — ''Billy the Reactive Banana''<br />
<br />
"This should be in a museum!" — ''Banana Jones''<br />
<br />
"Hey Mister! Why not use reactive-banana as a smartphone app to brush your teeth?" — ''Tommy "Banana" Johnson''<br />
<br />
== Releases and Resources ==<br />
* Download and installation from Hackage<br />
** {{HackagePackage|id=reactive-banana}} - the FRP library itself<br />
** {{HackagePackage|id=reactive-banana-sdl}} - binding to the [[SDL]] library<br />
** {{HackagePackage|id=reactive-banana-wx}} - binding to the [[wxHaskell]] GUI library<br />
<br />
* <span id="documentation">Documentation</span><br />
** '''[https://github.com/HeinrichApfelmus/reactive-banana/blob/07f3e9bf44ec8c227442daef723f7e9682c5a342/reactive-banana/doc/tutorial-2012-07-en.pdf?raw=true Slides from a tutorial given by the library author (pdf)]'''<br />
** [[FRP explanation using reactive-banana | Unofficial tutorial on the Haskell wiki]]<br />
** [http://hackage.haskell.org/package/reactive-banana API reference]<br />
** '''[[/Examples/]]'''<br />
** [http://apfelmus.nfshost.com/blog.html#functional-reactive-programming-frp Developer Blog]<br />
* <span id="feedback">Feedback</span> and Contact<br />
** Maintainer: [http://apfelmus.nfshost.com/ Heinrich Apfelmus]<br />
** Bugs and feature requests? [https://github.com/HeinrichApfelmus/reactive-banana/issues?sort=created&direction=desc&state=open Issue Tracker!]<br />
** Questions? [http://stackoverflow.com/questions/ask?tags=reactive-programming+haskell+frp+reactive-banana Ask on StackOverflow!]<br />
** More questions? [mailto:apfelmus%20at%20quantentunnel%20de Email] or [https://hackhands.com/apfelmus live help]!<br />
* Source code on github<br />
** [https://github.com/HeinrichApfelmus/reactive-banana/tree/master/reactive-banana reactive-banana] master branch<br />
** [https://github.com/HeinrichApfelmus/reactive-banana/tree/master/reactive-banana-wx reactive-banana-wx] master branch<br />
<br />
== External Links ==<br />
* [https://github.com/bernstein/breakout breakout], a small game<br />
<br />
<br />
[[Category:FRP]]<br />
[[Category:User interfaces]]<br />
[[Category:Libraries]]<br />
[[Category:wxHaskell]]<br />
[[Category:Packages]]<br />
[[Category:Robotics]]</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=DHD_UHac/Links&diff=45394DHD UHac/Links2012-04-24T08:22:32Z<p>Erik Hesselink: /* Announcements */ Added bumper announcement.</p>
<hr />
<div>Here, we collect various links around the web that are relevant to the DHD >>= UHac.<br />
<br />
== Photos ==<br />
<br />
* Tom Lokhorst<br />
** [https://twitter.com/#!/tomlokhorst/statuses/193268629284995072 Pascal Hof speaking].<br />
* [http://spl.smugmug.com/Dutch-Haskell-Users-Group/DHD-UHac-2012 Sean Leather's photos]<br />
** [http://spl.smugmug.com/Dutch-Haskell-Users-Group/DHD-UHac-2012/Friday-Apr-20/22545333_Rg2Ddr Friday]<br />
* [http://www.flickr.com/photos/spockz/sets/72157629872187931/ Alessandro Vermeulen]<br />
** [http://www.flickr.com/photos/spockz/6955427522/in/set-72157629872187931 DHD]<br />
<br />
Original photos from Alessandro are available upon request in print and digitally.<br />
<br />
== Announcements ==<br />
<br />
* Sean Leather announced his [https://plus.google.com/104222093009939197511/posts/PA82ATB9t7n latex-number-signs].<br />
* Gregory Collins was [https://plus.google.com/117852249512245938101/posts/Jup4smt8Bt7 hanging with the nerds].<br />
* Sean Leather [https://plus.google.com/104222093009939197511/posts/cPqYsoW2MDT reviewed] the event so far (Friday).<br />
* José Pedro Magalhães [https://plus.google.com/u/0/104222093009939197511/posts/TYDYRMzfZ2o updated] the [http://www.haskell.org/haskellwiki/Generics Haskell Generics] wiki page.<br />
* Jasper Van der Jeugt [http://jaspervdj.be/posts/2012-04-21-blaze-html-0.5.html released] [http://jaspervdj.be/blaze/ blaze-html-0.5].<br />
* Andres Löh migrated the [https://github.com/haskell/cabal cabal repository] to GitHub.<br />
* Jasper Van der Jeugt found a place for his [https://plus.google.com/113933723670373082880/posts/abcpx1H6Hpd Haskell sticker].<br />
* Erik Hesselink released [http://hackage.haskell.org/package/bumper bumper], a tool for bumping package versions transitively, on behalf of [http://www.silkapp.com Silk].</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=DHD_UHac/DHD_Program&diff=45277DHD UHac/DHD Program2012-04-16T08:41:58Z<p>Erik Hesselink: Changed my talk title.</p>
<hr />
<div>__NOTOC__<br />
<br />
This is the current program for the Dutch HUG Day. It may still change.<br />
<br />
{| class="wikitable"<br />
! Time<br />
! Title<br />
! Speaker<br />
|-<br />
| 9:30<br />
| colspan="2" | ''Coffee and Tea''<br />
|-<br />
| 10:00<br />
| Welcome<br />
| Sean Leather, Stef Joosten<br />
|-<br />
| 10:15<br />
| [[#websockets|WebSockets]]<br />
| Jasper Van der Jeugt<br />
|-<br />
| 10:45<br />
| [[#hesselink|''Building your own Haskell ecosystem'']]<br />
| Erik Hesselink<br />
|-<br />
| 11:15<br />
| [[#pascal|''Model Checking Abstract Syntax Trees'']]<br />
| Pascal Hof<br />
|-<br />
| 11:45<br />
|colspan="2"| ''Lightning Talks''<br />
|-<br />
|<br />
| [[#dotfs|DotFS]]<br />
| Paul van der Walt, Sjoerd Timmer<br />
|-<br />
|<br />
| [[#gruze|Snap and Gruze]]<br />
| Kevin Jardine<br />
|-<br />
|<br />
| [[#case-study|Case Study Invitation]]<br />
| Jurriaan Hage<br />
|-<br />
| 12:15<br />
| colspan="2" | ''Lunch (Provided by Ordina)''<br />
|-<br />
| 13:15<br />
| [[#practice|Haskell in Practice]]<br />
| Stef Joosten, Martijn Schrage<br />
|-<br />
| 13:45<br />
| [[#fclabels|fclabels]]<br />
| Sebastiaan Visser<br />
|-<br />
| 14:15<br />
| [[#jpm|''TBD'']]<br />
| José Pedro Magalhães<br />
|-<br />
| 14:45<br />
|colspan="2"| ''Lightning Talks''<br />
|-<br />
|<br />
| [[#holes|Holes in GHC]]<br />
| Thijs Alkemade<br />
|-<br />
|<br />
| [[#regex-applicative|Applicative Regular Expressions]]<br />
| Roman Cheplyaka<br />
|-<br />
|<br />
| ''Available''<br />
|<br />
|-<br />
| 15:15<br />
| Closing<br />
| Jurriën Stutterheim<br />
|-<br />
| 15:30<br />
| Depart for UHac<br />
|<br />
|}<br />
<br />
== Summaries ==<br />
<br />
=== <span id="websockets"></span>Supporting Different Versions of the WebSockets Protocol ===<br />
<br />
Jasper Van der Jeugt (Ghent)<br />
<br />
The Haskell websockets library allows you to write WebSocket-enabled<br />
servers in Haskell, bidirectional communication with the browser.<br />
However, browsers and their related specifications change fast, and<br />
there are different versions of the WebSockets protocol. This talk<br />
discusses a type-safe technique which disallows the programmer from<br />
using primitives not available in the chosen version, while still<br />
allowing the latest features.<br />
<br />
=== <span id="hesselink"></span>''Building your own Haskell ecosystem'' ===<br />
<br />
Erik Hesselink (Silk)<br />
<br />
When you develop a lot of different Haskell packages that work together, managing all these packages and their versions can be difficult. In this talk, I'll explain how we deal with this at Silk. I will show how to use Hackage 2.0 to build your own internal package repository, how to use cabal-dev to manage installed packages, and show a tool for bumping package versions. Together, this makes working on large amounts of packages with multiple people much easier.<br />
<br />
=== <span id="pascal"></span>''Model Checking Abstract Syntax Trees'' ===<br />
<br />
Pascal Hof (TU Dortmund)<br />
<br />
Model checking turned out to be a useful tool for the analysis of programs. Usually one transforms abstract syntax trees to control flow graphs, which offer a abstract representation of program behavior. Whenever one is not focused on program behavior but on structural properties of the program (e.g. semantic analysis of a compiler), model checking the abstract syntax tree comes in handy. My talk introduces a problem, which can be solved using model checking abstract syntax trees. Additionally, different approaches for a implementation will be discussed.<br />
<br />
=== <span id="dotfs"></span>DotFS - Or How Fred Solved His Config Clutter ===<br />
<br />
Paul van der Walt (UU), Sjoerd Timmer (UU)<br />
<br />
Everyone who has more than one account on Linux/Unix/OS X systems knows how hard is can be to keep track of all the different config files in your home directory. <tt>.vimrc</tt>, <tt>.muttrc</tt>, <tt>.hgrc</tt>, <tt>.screenrc</tt>, <tt>.bashrc</tt>, and <tt>.xinitrc</tt> are just a few, but we're sure you can come up with many more yourself. Imagine how wonderful your life could be if you just had an easy tool to keep track of different versions of all these files on all your machines. We argue that traditional version control systems on their own are not up the task and we provide an alternative.<br />
<br />
=== <span id="gruze"></span>Snap and Gruze ===<br />
<br />
Kevin Jardine<br />
<br />
Snap and Gruze. Developing an astronomy application using Snap and an experimental entity-attribute-value store for Haskell.<br />
=== <span id="case-study"></span>Invitation to Participate in a Functional Programming Case Study ===<br />
<br />
Jurriaan Hage (UU)<br />
<br />
I want to invite you to participate in an experiment in Haskell.<br />
In this experiment we are going to pit HaRe (the Haskell Refactorer)<br />
against Holmes (my plagiarism detector). The goal is to find out how much<br />
time somebody needs to refactor a Haskell program into something that<br />
is not recognizable by Holmes as plagiarism. We shall be looking at<br />
two groups of study: experienced programmers (we shall pretend they<br />
are paid for by newbies to make their assignments for them, and to do<br />
so without starting from scratch), and the newbies themselves.<br />
This experiment is a collaboration with Simon Thompson of Kent.<br />
He will take charge of the newbies, my task is to perform the experiment<br />
with experienced Haskell programmers, which is why I am now seeking for<br />
participants.<br />
<br />
=== <span id="practice"></span>Haskell in Practice: How Haskell Has Been Used in a (Paid) IT Project. ===<br />
<br />
Stef Joosten (Ordina), Martijn Schrage (Oblomov Systems)<br />
<br />
This presentation shows how new thinking helps the judiciary to gain control over and to reduce cost in a landscape of many different IT systems that serve the courts of law in the Netherlands.<br />
<br />
Although Haskell plays a role outside the limelight, the results have become possible because of a tool, Ampersand, which has been built in Haskell.<br />
<br />
The presentation is accompanied by a brief demonstration.<br />
<br />
=== <span id="fclabels"></span>fclabels: First Class Record Labels for Haskell ===<br />
<br />
Sebastiaan Visser (Silk)<br />
<br />
Haskell's record system for algebraic datatypes uses labels as accessors for fields within constructors. Record labels can be used for both selection and modification of individual fields within value, but only selection can be composed in a natural way. The special syntax for updates makes composing modifications very cumbersome. The fclabels package tries to solve this problem by implementing field accessors as first class Haskell values instead of special syntax. Labels are implemented as lenses and can easily be composed for both selection and modification. To avoid boilerplate labels can be derived using Template Haskell. This talk will give a brief introduction into the usage of the library and will show a bit of the inner workings as a bridge to future extensions.<br />
<br />
=== <span id="holes"></span>Holes in GHC ===<br />
<br />
Thijs Alkemade (UU)<br />
<br />
This will be a demonstration of work-in-progress on adding holes for type-based debugging with GHC. See the [http://hackage.haskell.org/trac/ghc/wiki/Holes GHC Trac page] for details.<br />
<br />
=== <span id="regex-applicative">Applicative Regular Expressions</span> ===<br />
<br />
Roman Cheplyaka<br />
<br />
In this short talk I am going to describe the<br />
[https://github.com/feuerbach/regex-applicative regex-applicative] project:<br />
* what it is about<br />
* how it compares to other parsing combinator libraries<br />
* its current state and unsolved problems<br />
<br />
I'll be glad to accept any help<br />
[http://www.haskell.org/haskellwiki/DHD_UHac/Projects#regex-applicative during UHac].</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=DHD_UHac/DHD_Program&diff=45276DHD UHac/DHD Program2012-04-16T08:41:23Z<p>Erik Hesselink: /* Filled in my talk subject */</p>
<hr />
<div>__NOTOC__<br />
<br />
This is the current program for the Dutch HUG Day. It may still change.<br />
<br />
{| class="wikitable"<br />
! Time<br />
! Title<br />
! Speaker<br />
|-<br />
| 9:30<br />
| colspan="2" | ''Coffee and Tea''<br />
|-<br />
| 10:00<br />
| Welcome<br />
| Sean Leather, Stef Joosten<br />
|-<br />
| 10:15<br />
| [[#websockets|WebSockets]]<br />
| Jasper Van der Jeugt<br />
|-<br />
| 10:45<br />
| [[#hesselink|''TBD'']]<br />
| Erik Hesselink<br />
|-<br />
| 11:15<br />
| [[#pascal|''Model Checking Abstract Syntax Trees'']]<br />
| Pascal Hof<br />
|-<br />
| 11:45<br />
|colspan="2"| ''Lightning Talks''<br />
|-<br />
|<br />
| [[#dotfs|DotFS]]<br />
| Paul van der Walt, Sjoerd Timmer<br />
|-<br />
|<br />
| [[#gruze|Snap and Gruze]]<br />
| Kevin Jardine<br />
|-<br />
|<br />
| [[#case-study|Case Study Invitation]]<br />
| Jurriaan Hage<br />
|-<br />
| 12:15<br />
| colspan="2" | ''Lunch (Provided by Ordina)''<br />
|-<br />
| 13:15<br />
| [[#practice|Haskell in Practice]]<br />
| Stef Joosten, Martijn Schrage<br />
|-<br />
| 13:45<br />
| [[#fclabels|fclabels]]<br />
| Sebastiaan Visser<br />
|-<br />
| 14:15<br />
| [[#jpm|''TBD'']]<br />
| José Pedro Magalhães<br />
|-<br />
| 14:45<br />
|colspan="2"| ''Lightning Talks''<br />
|-<br />
|<br />
| [[#holes|Holes in GHC]]<br />
| Thijs Alkemade<br />
|-<br />
|<br />
| [[#regex-applicative|Applicative Regular Expressions]]<br />
| Roman Cheplyaka<br />
|-<br />
|<br />
| ''Available''<br />
|<br />
|-<br />
| 15:15<br />
| Closing<br />
| Jurriën Stutterheim<br />
|-<br />
| 15:30<br />
| Depart for UHac<br />
|<br />
|}<br />
<br />
== Summaries ==<br />
<br />
=== <span id="websockets"></span>Supporting Different Versions of the WebSockets Protocol ===<br />
<br />
Jasper Van der Jeugt (Ghent)<br />
<br />
The Haskell websockets library allows you to write WebSocket-enabled<br />
servers in Haskell, bidirectional communication with the browser.<br />
However, browsers and their related specifications change fast, and<br />
there are different versions of the WebSockets protocol. This talk<br />
discusses a type-safe technique which disallows the programmer from<br />
using primitives not available in the chosen version, while still<br />
allowing the latest features.<br />
<br />
=== <span id="hesselink"></span>''Building your own Haskell ecosystem'' ===<br />
<br />
Erik Hesselink (Silk)<br />
<br />
When you develop a lot of different Haskell packages that work together, managing all these packages and their versions can be difficult. In this talk, I'll explain how we deal with this at Silk. I will show how to use Hackage 2.0 to build your own internal package repository, how to use cabal-dev to manage installed packages, and show a tool for bumping package versions. Together, this makes working on large amounts of packages with multiple people much easier.<br />
<br />
=== <span id="pascal"></span>''Model Checking Abstract Syntax Trees'' ===<br />
<br />
Pascal Hof (TU Dortmund)<br />
<br />
Model checking turned out to be a useful tool for the analysis of programs. Usually one transforms abstract syntax trees to control flow graphs, which offer a abstract representation of program behavior. Whenever one is not focused on program behavior but on structural properties of the program (e.g. semantic analysis of a compiler), model checking the abstract syntax tree comes in handy. My talk introduces a problem, which can be solved using model checking abstract syntax trees. Additionally, different approaches for a implementation will be discussed.<br />
<br />
=== <span id="dotfs"></span>DotFS - Or How Fred Solved His Config Clutter ===<br />
<br />
Paul van der Walt (UU), Sjoerd Timmer (UU)<br />
<br />
Everyone who has more than one account on Linux/Unix/OS X systems knows how hard is can be to keep track of all the different config files in your home directory. <tt>.vimrc</tt>, <tt>.muttrc</tt>, <tt>.hgrc</tt>, <tt>.screenrc</tt>, <tt>.bashrc</tt>, and <tt>.xinitrc</tt> are just a few, but we're sure you can come up with many more yourself. Imagine how wonderful your life could be if you just had an easy tool to keep track of different versions of all these files on all your machines. We argue that traditional version control systems on their own are not up the task and we provide an alternative.<br />
<br />
=== <span id="gruze"></span>Snap and Gruze ===<br />
<br />
Kevin Jardine<br />
<br />
Snap and Gruze. Developing an astronomy application using Snap and an experimental entity-attribute-value store for Haskell.<br />
=== <span id="case-study"></span>Invitation to Participate in a Functional Programming Case Study ===<br />
<br />
Jurriaan Hage (UU)<br />
<br />
I want to invite you to participate in an experiment in Haskell.<br />
In this experiment we are going to pit HaRe (the Haskell Refactorer)<br />
against Holmes (my plagiarism detector). The goal is to find out how much<br />
time somebody needs to refactor a Haskell program into something that<br />
is not recognizable by Holmes as plagiarism. We shall be looking at<br />
two groups of study: experienced programmers (we shall pretend they<br />
are paid for by newbies to make their assignments for them, and to do<br />
so without starting from scratch), and the newbies themselves.<br />
This experiment is a collaboration with Simon Thompson of Kent.<br />
He will take charge of the newbies, my task is to perform the experiment<br />
with experienced Haskell programmers, which is why I am now seeking for<br />
participants.<br />
<br />
=== <span id="practice"></span>Haskell in Practice: How Haskell Has Been Used in a (Paid) IT Project. ===<br />
<br />
Stef Joosten (Ordina), Martijn Schrage (Oblomov Systems)<br />
<br />
This presentation shows how new thinking helps the judiciary to gain control over and to reduce cost in a landscape of many different IT systems that serve the courts of law in the Netherlands.<br />
<br />
Although Haskell plays a role outside the limelight, the results have become possible because of a tool, Ampersand, which has been built in Haskell.<br />
<br />
The presentation is accompanied by a brief demonstration.<br />
<br />
=== <span id="fclabels"></span>fclabels: First Class Record Labels for Haskell ===<br />
<br />
Sebastiaan Visser (Silk)<br />
<br />
Haskell's record system for algebraic datatypes uses labels as accessors for fields within constructors. Record labels can be used for both selection and modification of individual fields within value, but only selection can be composed in a natural way. The special syntax for updates makes composing modifications very cumbersome. The fclabels package tries to solve this problem by implementing field accessors as first class Haskell values instead of special syntax. Labels are implemented as lenses and can easily be composed for both selection and modification. To avoid boilerplate labels can be derived using Template Haskell. This talk will give a brief introduction into the usage of the library and will show a bit of the inner workings as a bridge to future extensions.<br />
<br />
=== <span id="holes"></span>Holes in GHC ===<br />
<br />
Thijs Alkemade (UU)<br />
<br />
This will be a demonstration of work-in-progress on adding holes for type-based debugging with GHC. See the [http://hackage.haskell.org/trac/ghc/wiki/Holes GHC Trac page] for details.<br />
<br />
=== <span id="regex-applicative">Applicative Regular Expressions</span> ===<br />
<br />
Roman Cheplyaka<br />
<br />
In this short talk I am going to describe the<br />
[https://github.com/feuerbach/regex-applicative regex-applicative] project:<br />
* what it is about<br />
* how it compares to other parsing combinator libraries<br />
* its current state and unsolved problems<br />
<br />
I'll be glad to accept any help<br />
[http://www.haskell.org/haskellwiki/DHD_UHac/Projects#regex-applicative during UHac].</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=DHD_UHac/Attendees&diff=44533DHD UHac/Attendees2012-02-14T11:37:59Z<p>Erik Hesselink: </p>
<hr />
<div>This is a list of attendees for [[DHD_UHac|DHD >>= UHac]].<br />
<br />
If you have [[DHD_UHac/Register|registered]], please consider adding yourself to the list. Your contact and travel information may help with coordination between participants.<br />
<br />
If you live around Utrecht or plan to commute from home each day, you may put "Local" for accommodation.<br />
<br />
{| class="wikitable"<br />
! Nickname<br />
! Real Name (Affl)<br />
! Mobile #<br />
! Arrive<br />
! Depart<br />
! Accommodation<br />
|-<br />
| leather<br />
| Sean Leather (UU)<br />
| +31616158163<br />
|<br />
|<br />
| Local<br />
|-<br />
| norm2782<br />
| Jurriën Stutterheim (UU)<br />
| +31642392944<br />
|<br />
|<br />
| Local<br />
|-<br />
| ruud<br />
| Ruud Koot (UU)<br />
| +31623024223<br />
|<br />
|<br />
| Local<br />
|-<br />
| kosmikus<br />
| Andres Löh (Well-Typed LLP)<br />
|<br />
|<br />
|<br />
|<br />
|-<br />
| sol<br />
| Simon Hengel<br />
| +4917661064074<br />
|<br />
|<br />
|<br />
|-<br />
| dreixel<br />
| José Pedro Magalhães (UU)<br />
| +31650459029<br />
|<br />
|<br />
| Local<br />
|-<br />
| marczoid<br />
| Marc van Zee (UU)<br />
| +31633610518<br />
|<br />
|<br />
| Local<br />
|-<br />
| paba<br />
| Patrick Bahr (University of Copenhagen)<br />
|<br />
|<br />
|<br />
| Local<br />
|-<br />
| toothbrush<br />
| Paul van der Walt (UU)<br />
| +31614681351<br />
|<br />
|<br />
| Local<br />
|-<br />
| spockz<br />
| Alessandro Vermeulen (UU)<br />
| +31646165747<br />
|<br />
|<br />
| Local<br />
|-<br />
| wlad<br />
| Vlad Hanciuta<br />
|<br />
|<br />
|<br />
|<br />
|-<br />
| gcollins<br />
| Gregory Collins (Google)<br />
| +41 79 441 6832<br />
|<br />
|<br />
| Karel V Hotel<br />
|-<br />
| <br />
| Pascal Hof<br />
| <br />
|<br />
|<br />
| <br />
|-<br />
| jaspervdj<br />
| Jasper Van der Jeugt<br />
| +32 476 26 48 47<br />
|<br />
|<br />
| Yet undecided<br />
|-<br />
| cameleon<br />
| Erik Hesselink<br />
| +31 6 50 994 887<br />
|<br />
|<br />
| Local<br />
|}</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=CamHac/PostHackathonReport&diff=41603CamHac/PostHackathonReport2011-08-14T16:21:14Z<p>Erik Hesselink: </p>
<hr />
<div>= Post-Hackathon Report =<br />
<br />
This page is for listing what was done during the Hackathon. Please add a short description of what you worked on, with links to relevant blog posts, hackage packages, commits, etc.<br />
<br />
== fclabels 1.0 release ==<br />
<br />
New release of the '''fclabels''' package. The new package has a lot of code and documentation cleanups, support for partial labels in the case of multi-constructor datatypes and is about 20x as fast for setting and modifying as the previous version. Thanks everyone for helping me out!<br />
<br />
Hackage: http://hackage.haskell.org/package/fclabels-1.0.1<br />
<br />
Github: http://github.com/sebastiaanvisser/fclabels<br />
<br />
== GHC and base library improvements ==<br />
<br />
* [http://hackage.haskell.org/trac/ghc/ticket/5413 Add primops for bit population count]. These primops compile down to `POPCNT` instructions where available and fast fallbacks (implemented in C) otherwise.<br />
<br />
* [http://hackage.haskell.org/trac/ghc/ticket/5414 Add unchecked left and right bit shifts]: The Data.Bits.shift method uses a branch to check if the shift amount is larger than the word size and returns 0 in these cases. This extra safety makes performance worse in bit twiddling code.<br />
<br />
* Discussed unpacking of enums in GHC (not yet implemented).<br />
<br />
== Darcs ==<br />
<br />
New contributors:<br />
<br />
* use red text to report when <font color="red">we have a conflict</font> ([http://bugs.darcs.net/issue1681 issue1681],[http://bugs.darcs.net/patch646 patch646], Jeff Foster)<br />
* support 'since' in English dates parser<br />
* filter SSH output ([http://bugs.darcs.net/issue845 issue845], Jeff Foster and Sebastian Korten)<br />
* support arbitrary darcs command in darcs-test (Alexander Njemz)<br />
* output ISO dates in darcs changes? ([http://bugs.darcs.net/issue140 issue140], Alexander N, may be not a good idea)<br />
* add a last regrets prompt to interactive patch selection ([http://bugs.darcs.net/issue1920 issue1920], [http://bugs.darcs.net/patch655 patch655], Johannes Weiß)<br />
* [in-progress] support removing changes in amend-record ([http://bugs.darcs.net/issue1470 issue1470], Johannes Weiß)<br />
<br />
== wxHaskell ==<br />
<br />
* a Windows build fix ([https://sourceforge.net/mailarchive/forum.php?thread_name=CAA5%3D7kb%2BCmJ178tvrxtOnuswWBeBxYpSotiQWRXuKE3m_sByXA%40mail.gmail.com&forum_name=wxhaskell-devel patch])<br />
* a fix for [https://sourceforge.net/tracker/?func=detail&aid=3019730&group_id=73133&atid=536845 an issue with colorDialog] ([https://sourceforge.net/mailarchive/forum.php?thread_name=20110813150933.GA758%40dewdrop.local&forum_name=wxhaskell-devel patch])<br />
<br />
== hCole-server ==<br />
<br />
* A Snap-based web application that interacts with the COLE (see http://portal.acm.org/citation.cfm?id=1356080 and http://portal.acm.org/citation.cfm?id=1772965) framework for exploring compiler optimisation levels. The purpose of the web app is that collaborators can submit optimisation sequences to the COLE backend and retrieve the results when they are available after measuring.<br />
* Git repository of the web application can be found at https://github.com/itkovian/hcole-server<br />
<br />
== GObject Introspection ==<br />
<br />
* Work-in-progress binding generator for GObject-based libraries such as Gtk+ 3.<br />
* Started switching to [http://hackage.haskell.org/package/haskell-src-exts-1.11.1 haskell-src-exts] for code generation.<br />
* Patches currently on the ''camhac'' branch on [https://gitorious.org/haskell-gi/haskell-gi gitorious].<br />
<br />
== Snap Framework ==<br />
<br />
* Some work has been done on the authentication Snaplet, including an (incomplete) HDBC backend for it. An early work-in-progress can be found here: https://github.com/norm2782/snap<br />
* An example application which uses Snap 0.6 has been improved to use the authentication Snaplet. Another work-in-progress: https://github.com/norm2782/snap-guestbook<br />
* IPv6 support. (Vlad Hanciuta)<br />
<br />
== Data.Text ==<br />
<br />
* Further benchmarking, bug fixing to support the UTF-8 port. Progress can be found in the ''utf8'' branch here: http://github.com/jaspervdj/text<br />
<br />
== hs-poker ==<br />
<br />
* A "redneck naive" poker hand evaluator. Code is on github (https://github.com/fffej/HS-Poker). Hopefully intend to turn this into a poker bot playground for Haskell (Jeff / Sebastian)<br />
<br />
== haskell-mpi ==<br />
* New version 1.1.0 uploaded to hackage, including support for more MPI implementations, bugfixes and general awesomness<br />
* Upcoming Monad Reader would feature and article about parallel programming with MPI, written during the course of the hackathon (Dmitry Astapov)<br />
<br />
== HTTP ==<br />
<br />
Some work was done on setting up tests for HTTP. Additionally, some bugs were fixed, code was cleaned up, warnings removed and a start was made on improving the Network.Browser module.</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=ZuriHac2010/Attendees&diff=32830ZuriHac2010/Attendees2010-01-06T13:25:44Z<p>Erik Hesselink: </p>
<hr />
<div>This is the attendee list for [[ZuriHac]]. Please refer to the [[ZuriHac|main page]] for more information.<br />
<br />
= Attendees =<br />
<br />
Once you've [[ZuriHac/Register|registered]], please add your name to the following table:<br />
<br />
{| class="wikitable"<br />
! Nickname<br />
! Real Name<br />
! Affiliation<br />
! Mobile #<br />
! Arriving<br />
! Departing<br />
! Accomodation<br />
|-<br />
| coeus<br />
| Marc A. Ziegert<br />
| University of Paderborn<br />
| +49 17 5 6000 700<br />
| <br />
| <br />
| <br />
|-<br />
| Heffalump<br />
| Ganesh Sittampalam<br />
| Credit Suisse<br />
| +447968253467<br />
| <br />
| <br />
| <br />
|-<br />
| tibbe<br />
| Johan Tibell<br />
| Google<br />
| +41787978230<br />
| <br />
| <br />
| <br />
|-<br />
| <br />
| Keith Lomax<br />
| <br />
| <br />
| <br />
| <br />
| <br />
|-<br />
| sioraiocht<br />
| Tom Harper<br />
| Oxford University Computing Laboratory<br />
| +44 7533 998 591<br />
|<br />
|<br />
|<br />
|-<br />
| poucet<br />
| Christophe Poucet<br />
| Google<br />
| +41796691013<br />
| <br />
| <br />
| <br />
|-<br />
| zeuxis<br />
| Harald Holtmann<br />
| <br />
| +49 176 22053266<br />
| <br />
| <br />
| <br />
|-<br />
| rmies<br />
| Michel Rijnders<br />
| TTY (Amsterdam)<br />
| +31646442127<br />
|<br />
|<br />
|<br />
|-<br />
| <br />
| Simon Meier<br />
| ETH Zurich<br />
| <br />
|<br />
|<br />
|<br />
|-<br />
| Gh_<br />
| Guillaume Hoffmann<br />
|<br />
|<br />
| 19 morning<br />
| 21 afternoon<br />
|<br />
|-<br />
| vvv<br />
| Valery V. Vorotyntsev<br />
| Infopulse Ukraine<br />
|<br />
|<br />
|<br />
|<br />
|<br />
|-<br />
| jnwhiteh<br />
| Jim Whitehead<br />
| Oxford University Computing Laboratory<br />
| +44 7846 257 133<br />
| <br />
| <br />
|-<br />
| kolmodin<br />
| Lennart Kolmodin<br />
| Västra Götalandsregionen<br />
| +46 73 6223606<br />
| <br />
|<br />
| <br />
|-<br />
| madhadron<br />
| Frederick Ross<br />
| Ecole Polytechnique Federale de Lausanne<br />
| +41 79 710 02 11<br />
| <br />
|<br />
|<br />
|-<br />
| al-maisan<br />
| Muharem Hrnjadovic<br />
| <br />
| +49 (1577) 470-3749<br />
|19 morning<br />
|21 afternoon<br />
|Hotel Neufeld, Friesenbergstraße 15<br />
|<br />
|-<br />
| beschmi<br />
| Benedikt Schmidt<br />
| ETH Zurich<br />
|<br />
|<br />
|<br />
|<br />
|-<br />
| chr1s<br />
| Chris Eidhof<br />
| Tupil / Utrecht University<br />
| +31628887656<br />
|<br />
|<br />
|<br />
|-<br />
|<br />
| Martijn van Steenbergen<br />
| Utrecht University<br />
| <br />
|<br />
|<br />
|<br />
|-<br />
| hesselink<br />
| Erik Hesselink<br />
| typLAB<br />
| +31650994887<br />
|<br />
|<br />
|<br />
|}<br />
<br />
= Additional Comments =<br />
<br />
Please use this section to leave comments for other attendees, e.g. for organizing accommodation.</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=Hac5/Projects&diff=27689Hac5/Projects2009-04-20T07:53:25Z<p>Erik Hesselink: Added progress on ghc-goals.</p>
<hr />
<div>== Generic information ==<br />
<br />
You can apply for an account and a project using<br />
[http://community.haskell.org/admin/ the community server].<br />
<br />
Once you have an account and/or a project, you upload a Darcs repository as follows. First, initialize your repository on the server:<br />
<br />
$ ssh community.haskell.org<br />
you@haskell:~$ cd /srv/code/yourproject<br />
you@haskell:/srv/code/yourproject$ darcs init<br />
<br />
Then, log out and push your repository:<br />
<br />
$ darcs push community.haskell.org:/srv/code/yourproject<br />
<br />
== Demonstrations ==<br />
<br />
The following demos where held:<br />
<br />
* Jutaro, Leksah: the Haskell IDE<br />
* Don Stewart, vacuum + adaptive data structures<br />
* Tupil.com / chr1s: Real World Web Apps in Haskell<br />
* Thorkil Naur, interactive, time-sliced HPC code coverage<br />
* David Himmelstrup, the LHC Haskell Compiler.<br />
<br />
== Projects ==<br />
<br />
If you have a project that you want to work on at the Hackathon, please describe it here.<br />
<br />
Since Hackathons are great for teamwork, consider joining one of the projects mentioned below. If you're interested in one of these projects, add your name to the list of hackers under that project.<br />
<!-- Copy this template<br />
=== Project name ===<br />
<br />
==== Description ====<br />
<br />
I am a project. Love me.<br />
<br />
===== Hackers =====<br />
<br />
* Hacker 1<br />
* Hacker 2<br />
--><br />
<br />
=== Haskell Platform 1.0 ===<br />
<br />
Finish the construction and roll out of the new [http://www.haskell.org/pipermail/haskell/2009-March/021172.html Haskell Platform]<br />
<br />
==== Hackers ====<br />
<br />
* dcoutts<br />
* dons<br />
* Chris Eidhof (chr1s)<br />
* kolmodin<br />
<br />
Platform specified, generic unix tarball installer.<br />
<br />
==== Gentoo Linux ====<br />
<br />
Package the haskell platform and put into portage.<br />
<br />
Progress: All libraries and applications are in portage. GHC-6.10.2, haddock-2.4.2 and parallel-1.1.0.1 are still masked for testing, other packages are usable with older ghc versions.<br />
<br />
* kolmodin<br />
<br />
=== Darcs Sprint #2 ===<br />
<br />
==== Description ====<br />
<br />
The [http://wiki.darcs.net/index.html/Sprints/2009-04 second Darcs Sprint]. Help improve our beloved [http://en.wikipedia.org/wiki/Distributed_revision_control DVCS]! Add your nick to the list.<br />
<br />
==== Hackers ====<br />
<br />
* Reinier Lamers (tux_rocker)<br />
* Eric Kow (kowey)<br />
* Ben Moseley (benmos)<br />
* Ganesh Sittampalam (Heffalump)<br />
* Ian Lynagh (igloo)<br />
* Arjan Boeijink (arjanb)<br />
* Benedikt Schmidt (beschmi)<br />
* Petr Ročkai (mornfall)<br />
* Thorkil Naur (thorkilnaur)<br />
<br />
=== Grapefruit ===<br />
<br />
==== Description ====<br />
<br />
[[Grapefruit]] is a library for [[Functional Reactive Programming]] (FRP) with a focus on user interfaces. FRP makes it possible to implement reactive and interactive systems in a declarative style. With Grapefruit, user interfaces are described as networks of communicating widgets and windows. Communication is done via different kinds of signals which describe temporal behavior.<br />
<br />
==== Possible subprojects ====<br />
<br />
* graphics support<br />
** Jeff Heard expressed interest in adapting [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Hieroglyph Hieroglyph] to work with Grapefruit.<br />
** The classic version of Grapefruit contains quite a bit of OpenGL-based 3D animation stuff which could be ported to the current Grapefruit version.<br />
** We should also take a look at [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/rsagl RSAGL].<br />
* improvements of the UI part and the GTK+-based UI backend<br />
* Qt-based UI backend<br />
** [[HQK]] should be used for this.<br />
* addition or integration of some kind of physics engine<br />
** There is, for example, [[Hpysics]] from Roman Cheplyaka (Feuerbach)<br />
<br />
==== Licensing ====<br />
<br />
Grapefruit is BSD3-licensed, so all contributions to Grapefruit should be BSD3-licensed, too. If you don’t like this, please discuss this on the [http://projects.haskell.org/cgi-bin/mailman/listinfo/grapefruit Grapefruit mailing list] or contact [[User:Wolfgang Jeltsch|Wolfgang Jeltsch]].<br />
<br />
==== Hackers ====<br />
<br />
* Wolfgang Jeltsch (jeltsch)<br />
* Fraser Wilson<br />
* Roman Cheplyaka (Feuerbach)<br />
* Peter Verswyvelen<br />
* Thomas Davie<br />
<br />
There is a [http://www.doodle.com/hfcymxct953cpw7z doodle] for planning who is doing what.<br />
<br />
=== Leksah ===<br />
<br />
==== Description ====<br />
<br />
[http://leksah.org leksah] is an attempt to develop a Haskell IDE in Haskell. Help adding cool features to this Wannabee IDE, like:<br />
* Generate export list<br />
* Code Formatter<br />
* Infer types<br />
* ... <br />
<br />
==== Hackers ====<br />
<br />
* Jürgen Nicklisch (jutaro)<br />
<br />
<br />
=== Scion ===<br />
<br />
==== Description ====<br />
<br />
Scion is a library that aims to provide IDE-like functionality on top of the GHC API. It aims to be front-end agnostic, thus serve as a common middle-layer for various Haskell programming frontends like Emacs, Vim, Yi, Eclipse, etc.<br />
<br />
It currently only provides rudimentary functionality, such as loading a project and single-threaded background-typechecking. Currently, Scion's only frontend is Emacs, but a Vim frontend is in the underway. Possible Hackathon projects could be:<br />
<br />
* Extend Scion's capabilities. For example: cross-refs, jump to source, more type information, show haddock comments<br />
<br />
* Add another Scion frontend. E.g., hook up Yi or Eclipse with scion <br />
<br />
==== Hackers ====<br />
<br />
* Thomas Schilling (nominolo)<br />
* David Waern (waern)<br />
<br />
=== Type class aliases ===<br />
<br />
==== Description ====<br />
<br />
Type class aliases is a much wanted extension to Haskell proposed long ago by John Meacham ([http://repetae.net/recent/out/classalias.html John's website], [http://www.haskell.org/pipermail/haskell/2005-October/thread.html#16590 mailing list]) that has never been implemented yet. It is time this extension sees the light of day!<br />
<br />
GHC will be the target compiler. Perhaps GHC plugins ([http://hackage.haskell.org/trac/ghc/wiki/Plugins GHC wiki], [http://www.haskell.org/sitewiki/images/f/f0/TMR-Issue12.pdf The Monad Reader 12]) are of help here?<br />
<br />
Please have a look at the [[Context alias|context alias wiki page]] and extend it if you can.<br />
<br />
==== Ideas ====<br />
<br />
===== from Martijn van Steenbergen =====<br />
<br />
As a starting point we'll focus on supporting the following syntax:<br />
<br />
class alias FooBar a = (Foo a, Bar a)<br />
<br />
x :: FooBar a => a<br />
x = ...<br />
<br />
===== from Wolfgang Jeltsch =====<br />
<br />
A “class alias” actually doesn’t stand for a class but for a context (or a part of a context). So it might be better to choose a slightly different syntax:<br />
<br />
context Foobar a = (Foo a, Bar a)<br />
<br />
John Meacham proposes the following syntax for class aliases (context aliases) with superclass constraints:<br />
<br />
class alias Num a = Eq a => (Additive a, Multiplicative a)<br />
<br />
This is not consistent with the superclass syntax of class declarations. I think, we should use this syntax:<br />
<br />
class alias Eq a => Num a = (Additive a, Multiplicative a)<br />
<br />
Or better:<br />
<br />
context Eq a => Num a = (Additive a, Multiplicative a)<br />
<br />
==== Hackers ====<br />
<br />
* [[User:MartijnVanSteenbergen|Martijn van Steenbergen]]<br />
* [[User:sjoerd_visscher|Sjoerd Visscher]]<br />
* [[User:Basvandijk|Bas van Dijk]]<br />
* [[User:Roelvandijk|Roel van Dijk]]<br />
* Jeroen Leeuwestein<br />
* Remi Turk<br />
<br />
=== Goals in GHC(i) ===<br />
<br />
==== Description ====<br />
<br />
We will attempt to extend GHC(i) to give the type (and possibly context) of all 'undefined's in your code, similar to goals in Agda.<br />
<br />
==== Hackers ====<br />
<br />
* Sebastiaan Visser<br />
* Tom Lokhorst<br />
* Erik Hesselink<br />
* Rui Barbosa<br />
<br />
==== Progress ====<br />
<br />
We have a working prototype, and integration in GHCi. Code is available on GitHub [http://github.com/sebastiaanvisser/ghc-goals/], hackage package will follow soon.<br />
<br />
=== Containers: beyond Data.Map ===<br />
<br />
Scalable, adaptive persistent container types (Data.Map, Data.IntMap),<br />
<br />
* Don Stewart<br />
* Christophe Poucet<br />
* Nicolas Pouillard<br />
<br />
Summary of approach here: http://cpoucet.wordpress.com/2009/04/18/flattening-datamap/<br />
<br />
=== xmonad ===<br />
<br />
Some new extensions and developers.<br />
<br />
* Don Stewart<br />
* Nicolas Pouillard.<br />
<br />
=== Building a FastCGI interface for Happstack ===<br />
<br />
We've built a way to run Happstack applications on FastCGI, version 0.1.1 is now on hackage: [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/happstack-fastcgi happstack-fastcgi]<br />
<br />
Accompanying blogpost: http://blog.tupil.com/running-happstack-applications-with-fastcgi/<br />
<br />
* Eelco Lempsink<br />
* Chris Eidhof<br />
<br />
=== Yi ===<br />
<br />
Speed improvements and perhaps Scion integration.<br />
<br />
* David Waern<br />
Scion integration: Figured out a design for where store and call<br />
callbacks for initializing and closing Scion. Next step is to figure out<br />
how to avoid circular module dependencies.<br />
* David Himmelstrup (Lemmih)<br />
<br />
=== Complexity ===<br />
<br />
I released version 0.1.1 of [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/complexity complexity], a small package to determine the algorithmic complexity of a function.<br />
<br />
* Roel van Dijk<br />
<br />
=== Numerals ===<br />
<br />
We released version 0.1 of [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/numerals numerals], a package which does various things with numerals for a number of natural languages and numerical systems.<br />
<br />
For instance:<br />
<haskell><br />
> (cardinal enShort Masculine 42) :: Maybe String<br />
Just "forty-two"<br />
</haskell><br />
<br />
* Bas van Dijk<br />
* Roel van Dijk<br />
<br />
== Experiences ==<br />
<br />
Please list projects with which you are familiar. This way, people know whom to contact for more information or guidance on a particular project.<br />
<br />
{| class="wikitable"<br />
! Name<br />
! Projects<br />
|-<br />
| leather<br />
| [http://www.cs.uu.nl/wiki/GenericProgramming/EMGM EMGM], [http://www.cs.uu.nl/wiki/GenericProgramming/Multirec multirec]<br />
|-<br />
| jeltsch<br />
| [[Grapefruit]], [[HQK]]<br />
|-<br />
| jutaro<br />
| [http://www.leksah.org leksah]<br />
|-<br />
| sebas<br />
| [http://code.google.com/p/salvia-orchid/ salvia], [http://code.google.com/p/salvia-orchid/ orchid], filestore<br />
|-<br />
| waern<br />
| GHC (front-end), Haddock<br />
|-<br />
| Feuerbach<br />
| [http://xmonad.org xmonad], [[Hpysics]]<br />
|-<br />
| npouillard (ertai)<br />
| yi, xmonad, darcs<br />
|-<br />
| chr1s<br />
| formlets, sphinx, emgm, HAppS, EHC, web-related stuff<br />
|-<br />
| Lemmih<br />
| HAppS, LHC<br />
|}</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=Hac5/Dinner&diff=27656Hac5/Dinner2009-04-19T15:28:57Z<p>Erik Hesselink: </p>
<hr />
<div>== Dinner ==<br />
<br />
For sunday night, we will order asian food.<br />
<br />
Order before 18:00!<br />
<br />
== Options ==<br />
<br />
See http://tinyurl.com/hac5dinner<br />
<br />
For each meal you also have to choose whether you'd have white rice, nasi, bami, vegetarian nasi, vegetarian bami.<br />
<br />
== The List ==<br />
<br />
{| class="wikitable"<br />
! Name <br />
! Choice (number)<br />
! Rice/nasi/bami<br />
|-<br />
| David Himmelstrup<br />
| 700<br />
| Rice<br />
|-<br />
| Erik Hesselink<br />
| 701<br />
| nasi<br />
|-<br />
| Sebastiaan Visser<br />
| 704<br />
| nasi<br />
|-<br />
| Reinier Lamers<br />
| 57<br />
|-<br />
| Rui Barbosa<br />
| 701<br />
| nasi<br />
|}</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=Hac5/Dinner&diff=27654Hac5/Dinner2009-04-19T15:28:45Z<p>Erik Hesselink: </p>
<hr />
<div>== Dinner ==<br />
<br />
For sunday night, we will order asian food.<br />
<br />
Order before 18:00!<br />
<br />
== Options ==<br />
<br />
See http://tinyurl.com/hac5dinner<br />
<br />
For each meal you also have to choose whether you'd have white rice, nasi, bami, vegetarian nasi, vegetarian bami.<br />
<br />
== The List ==<br />
<br />
{| class="wikitable"<br />
! Name <br />
! Choice (number)<br />
! Rice/nasi/bami<br />
|-<br />
| David Himmelstrup<br />
| 700<br />
| Rice<br />
|-<br />
| Erik Hesselink<br />
| 701<br />
| nasi<br />
|-<br />
| Sebastiaan Visser<br />
| 704<br />
| nasi<br />
|-<br />
| Reinier Lamers<br />
| 57<br />
| -<br />
| Rui Barbosa<br />
| 701<br />
| nasi<br />
|}</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=Hac5/Dinner&diff=27652Hac5/Dinner2009-04-19T15:23:59Z<p>Erik Hesselink: </p>
<hr />
<div>== Dinner ==<br />
<br />
For sunday night, we will order asian food.<br />
<br />
Order before 18:00!<br />
<br />
== Options ==<br />
<br />
See http://tinyurl.com/hac5dinner<br />
<br />
For each meal you also have to choose whether you'd have white rice, nasi, bami, vegetarian nasi, vegetarian bami.<br />
<br />
== The List ==<br />
<br />
{| class="wikitable"<br />
! Name <br />
! Choice (number)<br />
! Rice/nasi/bami<br />
|-<br />
| David Himmelstrup<br />
| 700<br />
| Rice<br />
|-<br />
| Erik Hesselink<br />
| 701<br />
| nasi<br />
|-<br />
| Sebastiaan Visser<br />
| 704<br />
| nasi<br />
|}</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=Hac5/Dinner&diff=27651Hac5/Dinner2009-04-19T15:23:28Z<p>Erik Hesselink: </p>
<hr />
<div>== Dinner ==<br />
<br />
For sunday night, we will order asian food.<br />
<br />
Order before 18:00!<br />
<br />
== Options ==<br />
<br />
See http://tinyurl.com/hac5dinner<br />
<br />
For each meal you also have to choose whether you'd have white rice, nasi, bami, vegetarian nasi, vegetarian bami.<br />
<br />
== The List ==<br />
<br />
{| class="wikitable"<br />
! Name <br />
! Choice (number)<br />
! Rice/nasi/bami<br />
|-<br />
| David Himmelstrup<br />
| 700<br />
| Rice<br />
|-<br />
| Erik Hesselink<br />
| 701<br />
| nasi<br />
|-<br />
|}</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=Hac5/Projects&diff=27522Hac5/Projects2009-04-17T10:49:44Z<p>Erik Hesselink: </p>
<hr />
<div>== Generic information ==<br />
<br />
You can apply for an account and a project using<br />
[http://community.haskell.org/admin/ the community server].<br />
<br />
Once you have an account and/or a project, you upload a Darcs repository as follows. First, initialize your repository on the server:<br />
<br />
$ ssh community.haskell.org<br />
you@haskell:~$ cd /srv/code/yourproject<br />
you@haskell:/srv/code/yourproject$ darcs init<br />
<br />
Then, log out and push your repository:<br />
<br />
$ darcs push community.haskell.org:/srv/code/yourproject<br />
<br />
== Projects ==<br />
<br />
If you have a project that you want to work on at the Hackathon, please describe it here.<br />
<br />
Since Hackathons are great for teamwork, consider joining one of the projects mentioned below. If you're interested in one of these projects, add your name to the list of hackers under that project.<br />
<!-- Copy this template<br />
=== Project name ===<br />
<br />
==== Description ====<br />
<br />
I am a project. Love me.<br />
<br />
===== Hackers =====<br />
<br />
* Hacker 1<br />
* Hacker 2<br />
--><br />
<br />
=== Haskell Platform 1.0 ===<br />
<br />
Finish the construction and roll out of the new [http://www.haskell.org/pipermail/haskell/2009-March/021172.html Haskell Platform]<br />
<br />
==== Hackers ====<br />
<br />
* dcoutts<br />
* dons<br />
* Chris Eidhof (chr1s)<br />
* needed: windows/ macosx packagers.<br />
* BAMSE + Cabal for Windows<br />
<br />
=== Darcs Sprint #2 ===<br />
<br />
==== Description ====<br />
<br />
The [http://wiki.darcs.net/index.html/Sprints/2009-04 second Darcs Sprint]. Help improve our beloved [http://en.wikipedia.org/wiki/Distributed_revision_control DVCS]! Add your nick to the list.<br />
<br />
==== Hackers ====<br />
<br />
* Reinier Lamers (tux_rocker)<br />
* Eric Kow (kowey)<br />
* Ben Moseley (benmos)<br />
* Ganesh Sittampalam (Heffalump)<br />
* Ian Lynagh (igloo)<br />
* Arjan Boeijink (arjanb)<br />
* Benedikt Schmidt (beschmi)<br />
* Petr Ročkai (mornfall)<br />
* Thorkil Naur (thorkilnaur)<br />
<br />
=== Grapefruit ===<br />
<br />
==== Description ====<br />
<br />
[[Grapefruit]] is a library for [[Functional Reactive Programming]] (FRP) with a focus on user interfaces. FRP makes it possible to implement reactive and interactive systems in a declarative style. With Grapefruit, user interfaces are described as networks of communicating widgets and windows. Communication is done via different kinds of signals which describe temporal behavior.<br />
<br />
==== Possible subprojects ====<br />
<br />
* graphics support<br />
** Jeff Heard expressed interest in adapting [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Hieroglyph Hieroglyph] to work with Grapefruit.<br />
** The classic version of Grapefruit contains quite a bit of OpenGL-based 3D animation stuff which could be ported to the current Grapefruit version.<br />
** We should also take a look at [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/rsagl RSAGL].<br />
* improvements of the UI part and the GTK+-based UI backend<br />
* Qt-based UI backend<br />
** [[HQK]] should be used for this.<br />
* addition or integration of some kind of physics engine<br />
** There is, for example, [[Hpysics]] from Roman Cheplyaka (Feuerbach)<br />
<br />
==== Licensing ====<br />
<br />
Grapefruit is BSD3-licensed, so all contributions to Grapefruit should be BSD3-licensed, too. If you don’t like this, please discuss this on the [http://projects.haskell.org/cgi-bin/mailman/listinfo/grapefruit Grapefruit mailing list] or contact [[User:Wolfgang Jeltsch|Wolfgang Jeltsch]].<br />
<br />
==== Hackers ====<br />
<br />
* Wolfgang Jeltsch (jeltsch)<br />
* Fraser Wilson<br />
* Roman Cheplyaka (Feuerbach)<br />
* Peter Verswyvelen<br />
* Thomas Davie<br />
<br />
There is a [http://www.doodle.com/hfcymxct953cpw7z doodle] for planning who is doing what.<br />
<br />
=== Leksah ===<br />
<br />
==== Description ====<br />
<br />
[http://leksah.org leksah] is an attempt to develop a Haskell IDE in Haskell. Help adding cool features to this Wannabee IDE, like:<br />
* Generate export list<br />
* Code Formatter<br />
* Infer types<br />
* ... <br />
<br />
==== Hackers ====<br />
<br />
* Jürgen Nicklisch (jutaro)<br />
<br />
<br />
=== Scion ===<br />
<br />
==== Description ====<br />
<br />
Scion is a library that aims to provide IDE-like functionality on top of the GHC API. It aims to be front-end agnostic, thus serve as a common middle-layer for various Haskell programming frontends like Emacs, Vim, Yi, Eclipse, etc.<br />
<br />
It currently only provides rudimentary functionality, such as loading a project and single-threaded background-typechecking. Currently, Scion's only frontend is Emacs, but a Vim frontend is in the underway. Possible Hackathon projects could be:<br />
<br />
* Extend Scion's capabilities. For example: cross-refs, jump to source, more type information, show haddock comments<br />
<br />
* Add another Scion frontend. E.g., hook up Yi or Eclipse with scion <br />
<br />
==== Hackers ====<br />
<br />
* Thomas Schilling (nominolo)<br />
* David Waern (waern)<br />
<br />
=== Type class aliases ===<br />
<br />
==== Description ====<br />
<br />
Type class aliases is a much wanted extension to Haskell proposed long ago by John Meacham ([http://repetae.net/recent/out/classalias.html John's website], [http://www.haskell.org/pipermail/haskell/2005-October/thread.html#16590 mailing list]) that has never been implemented yet. It is time this extension sees the light of day!<br />
<br />
GHC will be the target compiler. Perhaps GHC plugins ([http://hackage.haskell.org/trac/ghc/wiki/Plugins GHC wiki], [http://www.haskell.org/sitewiki/images/f/f0/TMR-Issue12.pdf The Monad Reader 12]) are of help here?<br />
<br />
Please have a look at the [[Context alias|context alias wiki page]] and extend it if you can.<br />
<br />
==== Ideas ====<br />
<br />
===== from Martijn van Steenbergen =====<br />
<br />
As a starting point we'll focus on supporting the following syntax:<br />
<br />
class alias FooBar a = (Foo a, Bar a)<br />
<br />
x :: FooBar a => a<br />
x = ...<br />
<br />
===== from Wolfgang Jeltsch =====<br />
<br />
A “class alias” actually doesn’t stand for a class but for a context (or a part of a context). So it might be better to choose a slightly different syntax:<br />
<br />
context Foobar a = (Foo a, Bar a)<br />
<br />
John Meacham proposes the following syntax for class aliases (context aliases) with superclass constraints:<br />
<br />
class alias Num a = Eq a => (Additive a, Multiplicative a)<br />
<br />
This is not consistent with the superclass syntax of class declarations. I think, we should use this syntax:<br />
<br />
class alias Eq a => Num a = (Additive a, Multiplicative a)<br />
<br />
Or better:<br />
<br />
context Eq a => Num a = (Additive a, Multiplicative a)<br />
<br />
==== Hackers ====<br />
<br />
* [[User:MartijnVanSteenbergen|Martijn van Steenbergen]]<br />
* [[User:sjoerd_visscher|Sjoerd Visscher]]<br />
* [[User:Basvandijk|Bas van Dijk]]<br />
* [[User:Roelvandijk|Roel van Dijk]]<br />
* Jeroen Leeuwestein<br />
<br />
=== Goals in GHC(i) ===<br />
<br />
==== Description ====<br />
<br />
We will attempt to extend GHC(i) to give the type (and possibly context) of all 'undefined's in your code, similar to goals in Agda.<br />
<br />
==== Hackers ====<br />
<br />
* Sebastiaan Visser<br />
* Tom Lokhorst<br />
* Erik Hesselink<br />
<br />
=== Containers: beyond Data.Map ===<br />
<br />
Brainstorm approaches for scalable, high performance, data-dense container structures. Adaptive tries, open addressed hashtables?<br />
<br />
* Don Stewart<br />
<br />
=== Numeric Array Types ===<br />
<br />
Finish API for uvector, based on Data.Text experiences.<br />
<br />
* Don Stewart<br />
<br />
=== xmonad ===<br />
<br />
Happy to help with xmonad advice<br />
<br />
* Don Stewart<br />
<br />
=== Reviving mod_haskell ===<br />
<br />
Trying to build an Apache module with Haskell. Ultimate goal: make it trivial to deploy an Haskell web application on Apache.<br />
<br />
* Eelco Lempsink<br />
* Chris Eidhof<br />
<br />
=== Yi ===<br />
<br />
Speed improvements and perhaps Scion integration.<br />
<br />
* David Waern<br />
* David Himmelstrup (Lemmih)<br />
<br />
== Experiences ==<br />
<br />
Please list projects with which you are familiar. This way, people know whom to contact for more information or guidance on a particular project.<br />
<br />
{| class="wikitable"<br />
! Name<br />
! Projects<br />
|-<br />
| leather<br />
| [http://www.cs.uu.nl/wiki/GenericProgramming/EMGM EMGM], [http://www.cs.uu.nl/wiki/GenericProgramming/Multirec multirec]<br />
|-<br />
| jeltsch<br />
| [[Grapefruit]], [[HQK]]<br />
|-<br />
| jutaro<br />
| [http://www.leksah.org leksah]<br />
|-<br />
| sebas<br />
| [http://code.google.com/p/salvia-orchid/ salvia], [http://code.google.com/p/salvia-orchid/ orchid], filestore<br />
|-<br />
| waern<br />
| GHC (front-end), Haddock<br />
|-<br />
| Feuerbach<br />
| [http://xmonad.org xmonad], [[Hpysics]]<br />
|-<br />
| npouillard (ertai)<br />
| yi, xmonad, darcs<br />
|-<br />
| chr1s<br />
| formlets, sphinx, emgm, HAppS, EHC, web-related stuff<br />
|-<br />
| Lemmih<br />
| HAppS, LHC<br />
|}</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=Hac5/Attendees&diff=26676Hac5/Attendees2009-02-26T09:40:27Z<p>Erik Hesselink: </p>
<hr />
<div>This is the attendee list for [[Hac5]]. Please refer to the [[Hac5|main page]] for more information.<br />
<br />
= Attendees =<br />
<br />
Once you've [[Hac5/Register|registered]], please add your name to the following table:<br />
<br />
{| class="wikitable"<br />
! Nickname<br />
! Real Name<br />
! Affiliation<br />
! Mobile #<br />
! Arriving<br />
! Departing<br />
! Accomodation<br />
|-<br />
| eelco<br />
| Eelco Lempsink<br />
| UU + Tupil<br />
| +31629486398<br />
| -<br />
| -<br />
| Lives in Utrecht.<br />
|-<br />
| kosmikus<br />
| Andres Löh<br />
| UU<br />
|<br />
| -<br />
| -<br />
| Lives close to Utrecht.<br />
|-<br />
| dreixel<br />
| José Pedro Magalhães<br />
| UU<br />
| +31 650459029<br />
| -<br />
| -<br />
| Lives in Utrecht.<br />
|-<br />
| Heffalump<br />
| Ganesh Sittampalam<br />
| Credit Suisse<br />
| +447968253467<br />
| 17th morning (overnight ferry arrives Hook of Holland at 0630)<br />
| 19th late afternoon (overnight ferry leaves Hook of Holland at 2200)<br />
| Strowis Hostel<br />
|-<br />
| kowey<br />
| Eric Kow<br />
| University of Brighton<br />
|<br />
| 17th morning (overnight ferry)<br />
| 19th late afternoon (overnight ferry)<br />
| Strowis Hostel<br />
|-<br />
|<br />
| Martijn van Steenbergen<br />
| UU<br />
|<br />
|<br />
|<br />
| Lives close to Utrecht.<br />
|-<br />
| Igloo<br />
| Ian Lynagh<br />
| Well-Typed LLP<br />
|<br />
| 17th morning (overnight ferry)<br />
| 19th late afternoon (overnight ferry)<br />
| Strowis hostel<br />
|-<br />
| thorkilnaur<br />
| Thorkil Naur<br />
| thorkilnaur.com<br />
| +45 24 82 85 98<br />
| Probably April 16<br />
| Probably April 20<br />
| Don't know<br />
|-<br />
| tux_rocker<br />
| Reinier Lamers<br />
|<br />
| <br />
| -<br />
| -<br />
| Lives in Utrecht<br />
|-<br />
| Jutaro<br />
| Jürgen Nicklisch-Franken<br />
| ICS AG<br />
|<br />
| ?<br />
| ?<br />
| ?<br />
|-<br />
| kolmodin<br />
| Lennart Kolmodin<br />
| <br />
| +46736223606<br />
| Don't know yet.<br />
| Don't know yet.<br />
| Don't know yet.<br />
|-<br />
| chr1s<br />
| Chris Eidhof<br />
| UU + Tupil<br />
| +31628887656<br />
| -<br />
| -<br />
| Lives in Utrecht.<br />
|-<br />
| sebas<br />
| Sebastiaan Visser<br />
| UU<br />
| +31624828951<br />
| -<br />
| -<br />
| Lives in Utrecht.<br />
|-<br />
| dcoutts<br />
| Duncan Coutts<br />
| Well-Typed LLP<br />
|<br />
| 16th<br />
| 20th<br />
| Don't know yet.<br />
|-<br />
| benmos<br />
| Ben Moseley<br />
| Barcap<br />
| +447788138855<br />
| 17th morning (overnight ferry arrives Hook of Holland at 0630)<br />
| 19th late afternoon (overnight ferry leaves Hook of Holland at 2200)<br />
| Don't Know Yet<br />
|-<br />
| jeltsch<br />
| Wolfgang Jeltsch<br />
| BTU&nbsp;Cottbus<br />
| <br />
| at April&nbsp;17 in the morning (train arrives at 08:28)<br />
| at April&nbsp;19 in the afternoon (train departs at 16:59)<br />
| Hotel Oorsprongpark Utrecht<br />
|-<br />
-<br />
| beschmi<br />
| Benedikt Schmidt<br />
| ETH Zurich<br />
| +41 797417542<br />
| Don't know yet.<br />
| Don't know yet.<br />
| Don't know yet.<br />
|-<br />
| dons<br />
| Don Stewart<br />
| Galois<br />
|<br />
| Don't know yet.<br />
| Don't know yet.<br />
| Don't know yet.<br />
|-<br />
| blancolioni<br />
| Fraser Wilson<br />
| Anago bv<br />
| +31 6 81462922<br />
| -<br />
| -<br />
| Lives in Utrecht<br />
|-<br />
| Feuerbach<br />
| Roman Cheplyaka<br />
| <br />
|<br />
| Don't know yet.<br />
| Don't know yet.<br />
| Hospitality Club<br />
|-<br />
| hesselink<br />
| Erik Hesselink<br />
| UU<br />
| +31 650994887<br />
| -<br />
| -<br />
| Lives in Utrecht<br />
|}<br />
<br />
= Additional Comments =<br />
<br />
Please use this section to leave comments for other attendees, e.g. for organizing accommodation.</div>Erik Hesselinkhttps://wiki.haskell.org/index.php?title=Maintaining_laziness&diff=25347Maintaining laziness2008-12-30T15:16:43Z<p>Erik Hesselink: typo: catched -> caught</p>
<hr />
<div>One of Haskell's main features is [[non-strict semantics]], which in is implemented by [[lazy evaluation]] in all popular Haskell compilers.<br />
However many Haskell libraries found on [[Hackage]] are implemented just as if Haskell would be a strict language.<br />
This leads to unnecessary inefficiencies, [[memory leak]]s and, we suspect, unintended semantics.<br />
In this article we want to go through some techniques on how to check lazy behaviour on functions,<br />
examples of typical constructs which break laziness without need,<br />
and finally we want to link to techniques that may yield the same effect without laziness.<br />
<br />
== Checking laziness ==<br />
<br />
If you want to check whether a function is lazy enough, you may feed it with undefined values.<br />
An undefined value can be <hask>undefined</hask>, <hask>error "reason"</hask>, or an infinite loop.<br />
The latter one has the advantage that it cannot be hidden by some hacks like "catching" the error in the IO monad.<br />
<br />
Examples:<br />
Check whether <hask>filter</hask> is lazy:<br />
<haskell><br />
filter even [0..]<br />
filter even ([0..5] ++ undefined)<br />
</haskell><br />
If the <hask>filter</hask> function is lazy<br />
then it keeps generating elements in the first case<br />
and it outputs a prefix of the output list, before breaking because of the undefined, in the second case.<br />
<br />
An automated unit test can check whether infinite or corrupted input data produces correct prefixes.<br />
Those tests usually do not fail by returning <hask>False</hask> but by leading to undefined results,<br />
either explicit <hask>undefined</hask> or an infinite loop.<br />
<haskell><br />
testFilter0 = filter even [0..100] `isPrefixOf` filter even [0..]<br />
testFilter1 = filter even [0..100] `isPrefixOf` filter even ([0..102]++undefined)<br />
testFilter2 = let x = filter even [0..] !! 100 in x==x<br />
testFilter3 = let x = filter even ([0..102]++undefined) !! 50 in x==x<br />
</haskell><br />
<br />
<br />
== Laziness breakers ==<br />
<br />
=== Maybe, Either, Exceptions ===<br />
<br />
Some laziness breakers are visible in type signatures:<br />
<haskell><br />
decodeUTF8 :: [Word8] -> Either Message String<br />
</haskell><br />
The <hask>Either</hask> type signals that the function marks decoding failure by using the <hask>Left</hask> constructor of <hask>Either</hask>.<br />
This function cannot be lazy, because when you access the first character of the result,<br />
it must already be computed, whether the result is <hask>Left</hask> or <hask>Right</hask>.<br />
For this decision, the complete input must be decoded.<br />
A better type signature is<br />
<haskell><br />
decodeUTF8 :: [Word8] -> (Maybe Message, String)<br />
</haskell><br />
where the <hask>String</hask> contains as much characters as could be decoded<br />
and <hask>Maybe Message</hask> gives the reason for the stop of the decoding.<br />
<hask>Nothing</hask> means the input was completely read,<br />
<hask>Just msg</hask> means the decoding was aborted for the reason described in <hask>msg</hask>.<br />
If you touch the first element of the pair, the complete decodings is triggered, thus laziness is broken.<br />
This means you should first process the <hask>String</hask> and look at <hask>Maybe Message</hask> afterwards.<br />
<br />
Instead of the unspecific pair type you should use the special type for asynchronous exceptions as found in the [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/explicit-exception explicit exception] package.<br />
<br />
<br />
Especially in parsers you may find a function, called Wadler's force function.<br />
It works as follows:<br />
<haskell><br />
force y =<br />
let Just x = y<br />
in Just x<br />
</haskell><br />
It looks like a complicated expression for <hask>y</hask><br />
with an added danger of failing unrecoverably when <hask>y</hask> is not <hask>Just</hask>.<br />
Its purpose is to use the lazy pattern matching of <hask>let</hask><br />
and to show to the runtime system, that we expect that <hask>y</hask> is always a <hask>Just</hask>.<br />
Then the runtime system need not to wait until it can determine the right constructor but it can proceed immediately.<br />
This way a function can be made lazy, also if it returns <hask>Maybe</hask>.<br />
It can however fail, if later it turns out, that <hask>y</hask> is actually <hask>Nothing</hask>.<br />
<br />
Using force like functions is sometimes necessary,<br />
but should be avoided for data types with more than one constructor.<br />
It is better to use an interim data type with one constructor and lift to the multi-constructor datatype when needed.<br />
Consider parsers of type <hask>StateT [Word8] Maybe a</hask>.<br />
Now consider the parser combinator <haskell>many :: StateT [Word8] Maybe a -> StateT [Word8] Maybe [a]</haskell><br />
which parses as many elements of type <hask>a</hask> as possible.<br />
It shall be lazy and thus must be infallible and must not use the <hask>Maybe</hask>.<br />
It shall just return an empty list, if parsing of one element fails.<br />
A quick hack would be to define <hask>many</hask> using a <hask>force</hask> function.<br />
It would be better to show by the type, that <hask>many</hask> cannot fail:<br />
<haskell>many :: StateT [Word8] Maybe a -> StateT [Word8] Identity [a]</haskell>.<br />
<br />
=== Early decision ===<br />
<br />
==== List construction ====<br />
<br />
Be aware that the following two expression are not equivalent.<br />
<haskell><br />
-- less lazy<br />
if b then f x else f y<br />
-- more lazy<br />
f (if b then x else y)<br />
</haskell><br />
It is <hask>if undefined then f x else f y</hask> is <hask>undefined</hask>,<br />
whereas <hask>f (if b then x else y)</hask> if <hask>f undefined</hask>,<br />
which is a difference in [[non-strict semantics]].<br />
Consider e.g. <hask>if b then 'a':x else 'a':y</hask>.<br />
<br />
It is common source of too much strictness to make decisions too early and thus duplicate code in the decision branches.<br />
Intuitively spoken, the bad thing about [[code duplication]] (stylistic questions put aside) is,<br />
that the run-time system cannot see that in the branches some things are equal and do it in common before the critical decision.<br />
Actually, the compiler and run-time system could be "improved" to do so, but in order to keep things predictable, they do not do so.<br />
Even more, this behaviour is required by theory,<br />
since by pushing decisions to the inner of an expression you change the semantics of the expression.<br />
So we return to the question, what the programmer actually wants.<br />
<br />
Now, do you think this expression<br />
<haskell><br />
if b<br />
then [x]<br />
else y:ys<br />
</haskell><br />
is maximally lazy?<br />
It seems so, but actually it is not. In both branches we create non-empty lists, but the run-time system cannot see this.<br />
It is <hask>null (if undefined then [x] else y:ys)</hask> again <hask>undefined</hask>,<br />
but we like to have it evaluated to <hask>False</hask>.<br />
Here we need lazy pattern matching as provided by <hask>let</hask>.<br />
<haskell><br />
let z:zs =<br />
if b<br />
then [x]<br />
else y:ys<br />
in z:zs<br />
</haskell><br />
This expression always returns the constructor <hask>(:)</hask> and thus <hask>null</hask> knows that the list is not empty.<br />
However, this is a little bit unsafe, because the <hask>let z:zs</hask> may fail if in the branches of <hask>if</hask> there is an empty list.<br />
This error can only caught at run-time which is bad.<br />
We can avoid it using the single constructor pair type.<br />
<haskell><br />
let (z,zs) =<br />
if b<br />
then (x,[])<br />
else (y,ys)<br />
in z:zs<br />
</haskell><br />
which can be abbreviated to<br />
<haskell><br />
uncurry (:) (if b then (x,[]) else (y,ys))<br />
</haskell><br />
<br />
<br />
Another example is the <hask>inits</hask> function.<br />
In the Haskell 98 report the implementation<br />
<haskell><br />
inits :: [a] -> [[a]]<br />
inits [] = [[]]<br />
inits (x:xs) = [[]] ++ map (x:) (inits xs)<br />
</haskell><br />
is suggested.<br />
However you find that <hask>inits undefined</hask> is undefined,<br />
although <hask>inits</hask> always should return the empty list as first element.<br />
The following implementation does exactly this:<br />
<haskell><br />
inits :: [a] -> [[a]]<br />
inits xt =<br />
[] :<br />
case xt of<br />
[] -> []<br />
x:xs -> map (x:) (inits xs)<br />
</haskell><br />
See also the article on [[base cases and identities]].<br />
<br />
<br />
==== Reader-Writer-State monad ====<br />
<br />
I do not know whether the following example can be simplified.<br />
In this form it occured in a real application, namely the HTTP package.<br />
<br />
Consider the following action of the <hask>Control.Monad.RWS</hask> which fetches a certain number of elements from a list.<br />
The state of the monad is the input list we fetch the elements from.<br />
The reader part provides an element which means that the input is consumed.<br />
It is returned as singleton when the caller tries to read from a completely read input.<br />
The writer allows to log some information, however the considered action does not output something to the log.<br />
<haskell><br />
getN :: Int -> RWS a [Int] [a] [a]<br />
getN n =<br />
do input <- get<br />
if null input<br />
then asks (:[])<br />
else let (fetched,rest) = splitAt n input<br />
in put rest >> return fetched<br />
</haskell><br />
As we learned as good imperative programmers, we only call <hask>splitAt</hask> when the input is non-empty,<br />
that is, only if there is something to fetch.<br />
This works even more many corner cases, but not in the following one.<br />
Although <hask>getN</hask> does obviously not log something (i.e. it does not call <hask>tell</hask>),<br />
it requires to read the input in order to find out, that nothing was logged:<br />
<haskell><br />
*Test> (\(_a,_s,w) -> w) $ runRWS (getN 5) '\n' undefined<br />
*** Exception: Prelude.undefined<br />
</haskell><br />
<br />
The problem is again, that <hask>if</hask> checks the emptiness of the input,<br />
which is undefined, since the input is undefined.<br />
Thus we must ensure, that the invoked monadic actions are run independent from the input.<br />
Only this way, the run-time system can see that the logging stream is never touched.<br />
We start refactoring by calling <hask>put</hask> independently from <hask>input</hask>'s content.<br />
It works as well for empty lists, since <hask>splitAt</hask> will just return empty lists in this case.<br />
<haskell><br />
getN :: Int -> RWS a [Int] [a] [a]<br />
getN n =<br />
do input <- get<br />
let (fetched,rest) = splitAt n input<br />
put rest<br />
if null input<br />
then asks (:[])<br />
else return fetched<br />
</haskell><br />
This doesn't resolve the problem. There is still a choice between <hask>asks</hask> and <hask>return</hask>.<br />
We have to pull out <hask>ask</hask> as well.<br />
<haskell><br />
getN :: Int -> RWS a [Int] [a] [a]<br />
getN n =<br />
do input <- get<br />
let (fetched,rest) = splitAt n input<br />
put rest<br />
endOfInput <- ask<br />
return $<br />
if null input<br />
then [endOfInput]<br />
else fetched<br />
</haskell><br />
Now things work as expected:<br />
<haskell><br />
*Test> (\(_a,_s,w) -> w) $ runRWS (getN 5) '\n' undefined<br />
[]<br />
</haskell><br />
We learn from this example, that sometimes in Haskell it is more efficient to call functions that are not needed under some circumstances.<br />
Always remind, that the [[Do notation considered harmful|do notation]] looks only imperative, but it is not imperative.<br />
E.g., <hask>endOfInput</hask> is only evaluated if the end of the input is really reached.<br />
Thus, the call <hask>ask</hask> does not mean that there is actually an action performed between <hask>put</hask> and <hask>return</hask>.<br />
<br />
<br />
=== Strict pattern matching in a recursion ===<br />
<br />
Consider the <hask>partition</hask> function which sorts elements, that match a predicate, into one list and the non-matching elements into another list.<br />
This function should also work on infinite lists,<br />
but the implementation shipped with GHC up to 6.2 http://www.haskell.org/pipermail/libraries/2004-October/002645.html failed on infinite lists].<br />
What happened?<br />
The reason was a too strict pattern matching.<br />
<br />
Let's first consider the following correct implementation:<br />
<haskell><br />
partition :: (a -> Bool) -> [a] -> ([a], [a])<br />
partition p =<br />
foldr<br />
(\x ~(y,z) -><br />
if p x<br />
then (x : y, z)<br />
else (y, x : z))<br />
([],[])<br />
</haskell><br />
The usage of <hask>foldr</hask> seems to be reserved for advanced programmers.<br />
Formally <hask>foldr</hask> runs from the end to the start of the list.<br />
However, how can this work if there is a list without an end?<br />
That can be seen when applying the definition of <hask>foldr</hask>.<br />
<haskell><br />
foldr :: (a -> b -> b) -> b -> [a] -> b<br />
foldr _ b [] = b<br />
foldr f b (a:as) = f a (foldr f b as)<br />
</haskell><br />
Now we expand this once for an infinite input list, we get<br />
<haskell><br />
partition p (a:as) =<br />
(\ ~(y,z) -> if p a then (a:y, z) else (y, a:z)) (foldr ... ([],[]) as)<br />
</haskell><br />
We see that the whether <hask>a</hask> is prepended to the first or the second list,<br />
does only depend on <hask>p a</hask>, and neither on <hask>y</hask> nor on <hask>z</hask>.<br />
The laziness annotation <hask>~</hask> is crucial, since it tells, intuitively spoken,<br />
that we can rely on the recursive call of <hask>foldr</hask> to return a pair and not <hask>undefined</hask>.<br />
Omitting it, would require the evaluation of the whole input list before the first output element can be determined.<br />
This fails for infinite lists and is inefficient for finite lists, and that was the bug in former implementations of <hask>partition</hask>.<br />
Btw. by the expansion you also see, that it would not help to omit the tilde and apply the above 'force' trick to the 'if-then-else' expression.<br />
<br />
=== List reversal ===<br />
<br />
Any use of the list function <hask>reverse</hask> should alert you,<br />
since when you access the first element of a reversed list, then all nodes of the input list must be evaluated and stored in memory.<br />
Think twice whether it is really needed.<br />
The article [[Infinity and efficiency]] shows how to avoid list reversal.<br />
<br />
== Alternatives ==<br />
<br />
From the above issues you see that it laziness is a fragile thing.<br />
Only one moment where you do not pay attention and a function, carefully developed with laziness in mind, is no longer lazy, when you call it.<br />
The type system can almost not help you hunting laziness breakers<br />
and there is little support by debuggers.<br />
Thus detection of laziness breakers, often requires understanding of a large portion of code,<br />
which is against the idea of modularity.<br />
Maybe for your case you might prefer a different idiom,<br />
that achieves the same goals in a safer way.<br />
See e.g. the [[Enumerator and iteratee]] pattern.<br />
<br />
[[Category:Idioms]]</div>Erik Hesselink