https://wiki.haskell.org/api.php?action=feedcontributions&user=Ertai&feedformat=atomHaskellWiki - User contributions [en]2024-03-28T08:19:03ZUser contributionsMediaWiki 1.35.5https://wiki.haskell.org/index.php?title=Talk:What_a_Monad_is_not&diff=31960Talk:What a Monad is not2009-11-26T15:07:36Z<p>Ertai: </p>
<hr />
<div>==Nicolas Pouillard Comments==<br />
<br />
I disagree with:<br />
"So ordering is not in any way essential to what a monad is."<br />
<br />
There is commutative monads, great! Other than that the order is important. Moreover there is nothing wrong to see >>= as a sequencing operator.<br />
<br />
I also disagree the "IO is impure" paragraph:<br />
Indeed only IO will trigger visible side effects, but this is only due to the common evaluation of IO primitives. Moreover I would say that only the runtime system is impure because it does reduce 'main :: IO ()', other than that we are<br />
just building a computation plan in a pure way.<br />
<br />
Although I agree that the common issue is too mix monad and impurity, and the impurity question is only releated to IO.<br />
<br />
== "Monads are not values" ==<br />
<br />
Yes they are! But they are not of the type of their arguments. For instance "return 3" is a value that has (or can have) type "IO Int". But it is not a value of type Int. &mdash;[[User:Ashley Y|Ashley Y]] 23:44, 23 November 2009 (UTC)<br />
<br />
[Nicolas Pouillard]: The point was that the IO monad is not a value, of course there is values of type "IO Int". However the record/dictionary is a value and one could say that it is the monad.</div>Ertaihttps://wiki.haskell.org/index.php?title=Talk:What_a_Monad_is_not&diff=31786Talk:What a Monad is not2009-11-23T21:48:08Z<p>Ertai: </p>
<hr />
<div>==Nicolas Pouillard Comments==<br />
<br />
I disagree with:<br />
"So ordering is not in any way essential to what a monad is."<br />
<br />
There is commutative monads, great! Other than that the order is important. Moreover there is nothing wrong to see >>= as a sequencing operator.<br />
<br />
I also disagree the "IO is impure" paragraph:<br />
Indeed only IO will trigger visible side effects, but this is only due to the common evaluation of IO primitives. Moreover I would say that only the runtime system is impure because it does reduce 'main :: IO ()', other than that we are<br />
just building a computation plan in a pure way.<br />
<br />
Although I agree that the common issue is too mix monad and impurity, and the impurity question is only releated to IO.</div>Ertaihttps://wiki.haskell.org/index.php?title=Talk:What_a_Monad_is_not&diff=31785Talk:What a Monad is not2009-11-23T21:46:37Z<p>Ertai: </p>
<hr />
<div>I disagree with:<br />
"So ordering is not in any way essential to what a monad is."<br />
<br />
There is commutative monads, great! Other than that the order is important. Moreover there is nothing wrong to see >>= as a sequencing operator.<br />
<br />
I also disagree the "IO is impure" paragraph:<br />
Indeed only IO will trigger visible side effects, but this is only due to the common evaluation of IO primitives. Moreover I would say that only the runtime system is impure because it does reduce 'main :: IO ()', other than that we are<br />
just building a computation plan in a pure way.<br />
<br />
Although I agree that the common issue is too mix monad and impurity, and the impurity question is only releated to IO.</div>Ertaihttps://wiki.haskell.org/index.php?title=What_a_Monad_is_not&diff=31784What a Monad is not2009-11-23T21:37:42Z<p>Ertai: Fix the strictness part</p>
<hr />
<div>==Warning==<br />
This page is currently an unprocessed braindump. Feel free to dump additional stuff or massage stuff into didactic pleasures.<br />
<br />
Also, don't be surprised if you leave this page more confused than before. That just means that it has successfully destroyed your false assumptions, or that you've fallen for some horrible inside joke. Beware of [[Zygohistomorphic prepromorphisms]]. Go for [http://ertes.de/articles/monads.html warm and fuzzy], instead.<br />
<br />
==Monads are not a good choice as topic for your first Haskell blog entry==<br />
...just accept that they're [http://byorgey.wordpress.com/2009/01/12/abstraction-intuition-and-the-monad-tutorial-fallacy/ burritos], and wait until later.<br />
<br />
==Monads are not a language feature==<br />
Really. They are defined in terms of Haskell, not Haskell in terms of them. Conversely,<br />
<br />
==Haskell doesn't need Monads==<br />
...well, apart from the Haskell standard defining the way IO is done in terms of Monads: It could be done differently and still work.<br />
<br />
==Monads are not impure==<br />
...In no way whatsoever. You don't even need flexible morals to claim it. To be more specific, it's IO that's impure. That makes the IO monad impure. But that's not a general property of monads - just IO. And even then, we can pretend that Haskell is a purely functional description language for imperative programs. But we didn't want to employ flexible morals, now did we?<br />
<br />
==Monads are not about state==<br />
While it is certainly possible to abstract away explicit state passing by using a Monad, that's not what a monad is.<br />
<br />
==Monads are not about strictness==<br />
Monad operations (bind and return) have to be lazy in fact, always! However<br />
other operations can be specific to each monad.<br />
For instance some are strict (like IO), and some are lazy (like []). Then there are some that come in multiple flavours, like State.<br />
<br />
==Monads are not values==<br />
This point might be driven home best by pointing out that instance Monad Foo where ... is not a data type, but a declaration of a typeclass instance. However, to elaborate:<br />
<br />
Monads are not values in the same sense that addition and multiplication are not numbers: They capture a -- very specific -- relationship between values of a specific domain into a common abstraction. We're going to call these values monads manage ''mobits'', somewhat like this:<br />
<br />
type Mobit m a = Monad m => m a<br />
<br />
The IO monad manages mobits representing side-effects ("IO actions").<br />
<br />
The List monad manages mobits representing multiple values ("[a]")<br />
<br />
The Reader monads manages mobits that are pure computations that use asks to propagate information instead of explicit arguments<br />
<br />
...and while addition and multiplication are both monoids over the positive natural numbers, a monad is a monoid in a category of endofunctors. It's all very simple.<br />
<br />
<br />
<br />
==Monads are not a replacement for applicative functors==<br />
Instead, every monad ''is'' an applicative functor (as well as a functor). It is considered good practice not to use >>= if all you need is <*>, or even fmap.<br />
<br />
Not confusing what features of monads are specific to monads only and which stem from applicative functors are vitally important for a deeper understanding of monads. As an example, the applicative functor interface of parser libraries can parse context-free grammars (and look just like EBNF), while the monadic interface can parse context-sensitive grammars: Monads allow you to influence further processing by inspecting the result of your parse. To understand why, have a look at the type of >>=. To understand why applicative functors by themselves are sufficient to track the current parsing position, have a look at the uu-parsinglib tutorial.<br />
<br />
The exact differences are elaborated in even greater detail in Brent Yorgey's excellent [[Typeclassopedia]].<br />
<br />
==Monads are not about ordering==<br />
It's a commonplace that monads are about ordering sequences of computations. But this is misleading. Just as you can use monads for state, or strictness, you can use them to order computations. But there are also commutative monads, like Maybe, that don't order anything. So ordering is not in any way essential to what a monad is.<br />
<br />
----<br />
> Just 2 >> Just 3<br />
<br />
Just 3<br />
<br />
That's not commutative in the same intutive sense as "a + b === b + a".<br />
<br />
Commutativity, wrt. Monads, means that<br />
<br />
(x <- a; y <- b; return (x,y)) === (y <- b; x <- a; return (x,y))<br />
<br />
So we need some better notion of "ordering" to get to the bottom of this.</div>Ertaihttps://wiki.haskell.org/index.php?title=Hac5/Attendees/Photo&diff=27606Hac5/Attendees/Photo2009-04-18T15:49:26Z<p>Ertai: </p>
<hr />
<div>'''Hac5: Group photo'''<br />
<br />
[[Photo Full Size]]<br />
<br />
[[Image:Hac5.jpg]]<br />
<br />
[[Image:Hac5Legend.jpg]]<br />
<br />
{| class="wikitable"<br />
! Number<br />
! Name (nick)<br />
|-<br />
| 1<br />
| -<br />
|-<br />
| 2<br />
| Benedikt Schmidt (beschmi)<br />
|-<br />
| 3<br />
| -<br />
|-<br />
| 4<br />
| -<br />
|-<br />
| 5<br />
| -<br />
|-<br />
| 6<br />
| -<br />
|-<br />
| 7<br />
| -<br />
|-<br />
| 8<br />
| -<br />
|-<br />
| 9<br />
| -<br />
|-<br />
| 10<br />
| -<br />
|-<br />
| 11<br />
| David Himmelstrup (Lemmih)<br />
|-<br />
| 12<br />
| -<br />
|-<br />
| 13<br />
| -<br />
|-<br />
| 14<br />
| -<br />
|-<br />
| 15<br />
| -<br />
|-<br />
| 16<br />
| -<br />
|-<br />
| 17<br />
| -<br />
|-<br />
| 18<br />
| Nicolas Pouillard (npouillard, ertai)<br />
|-<br />
| 19<br />
| -<br />
|-<br />
| 20<br />
| -<br />
|-<br />
| 21<br />
| -<br />
|-<br />
| 22<br />
| -<br />
|-<br />
| 23<br />
| -<br />
|-<br />
| 24<br />
| -<br />
|-<br />
| 25<br />
| -<br />
|-<br />
| 26<br />
| -<br />
|-<br />
| 27<br />
| Thomas Davie (beelsebob)<br />
|-<br />
| 28<br />
| -<br />
|-<br />
| 29<br />
| -<br />
|-<br />
| 30<br />
| -<br />
|-<br />
| 31<br />
| -<br />
|-<br />
| 32<br />
| -<br />
|-<br />
| 33<br />
| -<br />
|-<br />
| 34<br />
| -<br />
|-<br />
| 35<br />
| Christophe Poucet (vincenz/poucet)<br />
|-<br />
| 36<br />
| -<br />
|-<br />
| 37<br />
| -<br />
|-<br />
| 38<br />
| Ian Lynagh (Igloo)<br />
|-<br />
| 39<br />
| -<br />
|-<br />
| 40<br />
| José Pedro Magalhães (dreixel)<br />
|-<br />
| 41<br />
| -<br />
|-<br />
| 42<br />
| -<br />
|-<br />
| 43<br />
| -<br />
|-<br />
| 44<br />
| -<br />
|-<br />
| 45<br />
| -<br />
|-<br />
| 46<br />
| Thorkil Naur (thorkilnaur)<br />
|-<br />
| 47<br />
| -<br />
|}</div>Ertaihttps://wiki.haskell.org/index.php?title=Hac5/Dinner&diff=27578Hac5/Dinner2009-04-18T12:32:42Z<p>Ertai: </p>
<hr />
<div>== Dinner ==<br />
<br />
For saturday night dinner, you have a choice out of 6 tasty options.<br />
<br />
We need to order '''BEFORE 15:00''', so if you want to join us, make sure your name is on this list!<br />
<br />
Dinner is paid for by the sponsors, and drinks as long as funds allow.<br />
<br />
We'll be going to Florin (http://florinutrecht.nl) and are expected at 20:00.<br />
<br />
== Options ==<br />
<br />
# Chicken Satay<br />
# Beef Burger<br />
# Veggie Burger<br />
# Salmon Filet<br />
# Spareribs<br />
# Steak<br />
<br />
== The List ==<br />
<br />
{| class="wikitable"<br />
! Name <br />
! Choice <br />
|-<br />
| Eelco Lempsink <br />
| 3 <br />
|-<br />
|-<br />
| Reinier Lamers<br />
| 3<br />
|-<br />
|-<br />
| Ben Moseley<br />
| 1<br />
|-<br />
|-<br />
| Ganesh Sittampalam<br />
| 6<br />
|-<br />
| Benedikt Schmidt<br />
| 6<br />
|-<br />
| Eric Kow<br />
| 4<br />
|-<br />
| Petr Rockai<br />
| 3<br />
|-<br />
| Arjan Boeijink<br />
| 1<br />
|-<br />
| Don Stewart<br />
| 3<br />
|-<br />
| Markus Klinik<br />
| 1<br />
|-<br />
| Vincent Zweije<br />
| 5<br />
|-<br />
| Roman Cheplyaka<br />
| 1<br />
|-<br />
| Simon Hengel<br />
| 3<br />
|-<br />
| Ian Lynagh<br />
| 2<br />
|-<br />
| Remi Turk<br />
| 6<br />
|-<br />
| Atze Dijkstra<br />
| 4<br />
|-<br />
| Andres Loeh<br />
| 2<br />
|-<br />
| Clara Loeh<br />
| 6<br />
|-<br />
| Martijn van Steenbergen<br />
| 1<br />
|-<br />
| Wolfgang Jeltsch<br />
| 2<br />
|-<br />
| Thomas Davie<br />
| 6<br />
|-<br />
| Peter Verswyvelen<br />
| 6<br />
|-<br />
| Roel van Dijk<br />
| 6<br />
|-<br />
| Bas van Dijk<br />
| 6<br />
|-<br />
| Erik Hesselink<br />
| 6<br />
|-<br />
| Tom Lokhorst<br />
| 5<br />
|-<br />
| Rui Barbosa<br />
| 4<br />
|-<br />
| Sebastiaan Visser<br />
| 6<br />
|-<br />
| Thomas Schilling<br />
| 1<br />
|-<br />
| José Pedro Magalhães<br />
| 1<br />
|-<br />
| David Himmelstrup<br />
| 4<br />
|-<br />
| Nicolas Pouillard<br />
| 5<br />
|}</div>Ertaihttps://wiki.haskell.org/index.php?title=Hac5/Attendees&diff=27513Hac5/Attendees2009-04-16T19:12:49Z<p>Ertai: changed my hostel and remove my phone number</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 />
| +31-6-55501239<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 />
| April 17 (train 9.58, a bit late, but very convenient)<br />
| April 19 (train 19.29)<br />
| Hotel Oorsprongpark Utrecht<br />
|-<br />
| tux_rocker<br />
| Reinier Lamers<br />
| UU<br />
| <br />
| -<br />
| -<br />
| Lives in Utrecht<br />
|-<br />
| Jutaro<br />
| Jürgen Nicklisch-Franken<br />
| ICS AG<br />
|<br />
| 16th 23:00<br />
| 19th 17:00<br />
| Hotel de Admiraal<br />
|-<br />
| kolmodin<br />
| Lennart Kolmodin<br />
| VGR IT/Chalmers<br />
| +46736223606<br />
| 16th (12:05 Schiphol)<br />
| 20th (20:24 Schiphol)<br />
| Friend's place.<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 />
| Hotel Oorsprongpark Utrecht<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 />
| [http://galois.com Galois]<br />
|<br />
| United 0908 Apr 16<br />
| 19th late afternoon (overnight ferry) <br />
| Malie Hotel BV<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 />
| +380 66 228 57 80<br />
| 16th in the evening<br />
| 21th in the morning<br />
| Strowis or hospitality club<br />
|-<br />
| hesselink<br />
| Erik Hesselink<br />
| UU<br />
| +31 650994887<br />
| -<br />
| -<br />
| Lives in Utrecht<br />
|-<br />
| -<br />
| Marnix Klooster<br />
| Infor/private<br />
| -<br />
| 17th in the morning<br />
| 17th in the afternoon, or sometime on the 18th<br />
| Lives close to Utrecht<br />
|-<br />
|arjanb<br />
|Arjan Boeijink<br />
| -<br />
| -<br />
|Either the 17th or 18th in morning<br />
|19th in the evening<br />
|Not decided yet on traveling or finding a place to sleep.<br />
|-<br />
| Chatterbox<br />
| Peter Verswyvelen<br />
| [http://www.anygma.com/ Anygma]<br />
| <br />
| April&nbsp;17 in the afternoon<br />
| April&nbsp;19 in the afternoon<br />
| Apollo Hotel Utrecht City Centre<br />
|-<br />
| Beelsebob<br />
| Thomas Davie<br />
| [http://www.anygma.com/ Anygma]<br />
| <br />
| April&nbsp;17 in the afternoon<br />
| April&nbsp;19 in the afternoon<br />
| Apollo Hotel Utrecht City Centre<br />
|-<br />
| basvandijk<br />
| Bas van Dijk<br />
| Radboud Universiteit Nijmegen<br />
| +31614065248<br />
| 17th, morning, by car<br />
| 19th, evening<br />
| Will drive each day.<br />
|-<br />
|<br />
| Roel van Dijk<br />
| Radboud Universiteit Nijmegen<br />
| +31612856453<br />
| 17th, morning, by car<br />
| 19th, evening<br />
| Will drive each day.<br />
|-<br />
| remi<br />
| Remi Turk<br />
| UvA / UU<br />
| <br />
| -<br />
| -<br />
| Don't know yet<br />
|-<br />
| npouillard (ertai)<br />
| Nicolas Pouillard<br />
| INRIA<br />
| <br />
| 17th, morning<br />
| 19th, afternoon<br />
| Strowis<br />
|-<br />
|nominolo<br />
|Thomas Schilling<br />
|University of Kent<br />
|<br />
|16th, probably<br />
|20th<br />
|friend's place<br />
|-<br />
| waern<br />
| David Waern<br />
| Amadeus<br />
| +33 642508769<br />
| 16th<br />
| 20th<br />
| Hotel Valk De Biltsche Hoek<br />
|-<br />
| mornfall<br />
| Petr Ročkai<br />
| Masaryk University<br />
| <br />
| 17th 9:58 by train (to Utrecht Centraal)<br />
| 19th 19:29 by train<br />
| Friend's place<br />
|-<br />
|<br />
| Jeroen Fokker<br />
| UU<br />
|<br />
| -<br />
| -<br />
| Lives in Utrecht<br />
|-<br />
| sol<br />
| Simon Hengel<br />
| <br />
| +4917661064074<br />
| -<br />
| -<br />
| Don't know yet<br />
|-<br />
| Lemmih<br />
| David Himmelstrup<br />
|<br />
|<br />
| 16th (13:55 Schiphol)<br />
| 20th (21:10 Schiphol)<br />
| Hotel Valk De Biltsche Hoek<br />
|-<br />
|<br />
| Tom Lokhorst<br />
| UU<br />
|<br />
| 16th<br />
| 18th<br />
| Lives close to Utrecht.<br />
|-<br />
| <br />
| Wouter Swierstra<br />
| Chalmers University of Technology<br />
|<br />
| 17th<br />
| and maybe longer<br />
| <br />
|-<br />
| mkl<br />
| Markus Klinik<br />
| <br />
| +4917666101511<br />
| 17th<br />
| 20th<br />
| Don't know yet<br />
|-<br />
| vincenz / poucet<br />
| Christophe Poucet<br />
| Google<br />
| +44796691013<br />
| 17th<br />
| 19th<br />
| Undecided.<br />
|-<br />
| <br />
| Alex Gerdes<br />
| Open Universiteit NL<br />
| <br />
| 17th<br />
| 17th<br />
| <br />
|}<br />
<br />
= Additional Comments =<br />
<br />
Please use this section to leave comments for other attendees, e.g. for organizing accommodation.</div>Ertaihttps://wiki.haskell.org/index.php?title=Hac5/Projects&diff=27351Hac5/Projects2009-04-05T14:45:21Z<p>Ertai: </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 />
* needed: windows/ macosx packagers.<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 />
=== 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<br />
<br />
* Add another Scion frontend. E.g., hook up Yi or Eclipse with scion <br />
<br />
==== Hackers ====<br />
<br />
* Thomas Schilling (nominolo)<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 />
<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 />
|}</div>Ertaihttps://wiki.haskell.org/index.php?title=Hac5/Attendees&diff=27102Hac5/Attendees2009-03-19T17:54:15Z<p>Ertai: </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 />
| April 17 (train 9.58, a bit late, but very convenient)<br />
| April 19 (train 19.29)<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 />
| 16th 23:00<br />
| 19th 17:00<br />
| Hotel de Admiraal<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 />
| Hotel Oorsprongpark Utrecht<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 />
| 16th in the evening<br />
| 21th in the morning<br />
| Strowis<br />
|-<br />
| hesselink<br />
| Erik Hesselink<br />
| UU<br />
| +31 650994887<br />
| -<br />
| -<br />
| Lives in Utrecht<br />
|-<br />
| -<br />
| Marnix Klooster<br />
| Infor/private<br />
| -<br />
| -<br />
| -<br />
| Lives close to Utrecht<br />
|-<br />
|arjanb<br />
|Arjan Boeijink<br />
| -<br />
| -<br />
|Either the 17th or 18th in morning<br />
|19th in the evening<br />
|Not decided yet on traveling or finding a place to sleep.<br />
|-<br />
| Chatterbox<br />
| Peter Verswyvelen<br />
| Antwerp<br />
| <br />
| April&nbsp;17 in the afternoon<br />
| April&nbsp;19 in the afternoon<br />
| Apollo Hotel Utrecht City Centre<br />
|-<br />
| Beelsebob<br />
| Thomas Davie<br />
| Antwerp<br />
| <br />
| April&nbsp;17 in the afternoon<br />
| April&nbsp;19 in the afternoon<br />
| Apollo Hotel Utrecht City Centre<br />
|-<br />
| basvandijk<br />
| Bas van Dijk<br />
| Radboud Universiteit Nijmegen<br />
| +31614065248<br />
| 17th, morning, by car<br />
| 19th, evening<br />
| Don't know yet.<br />
|-<br />
|<br />
| Roel van Dijk<br />
| Radboud Universiteit Nijmegen<br />
| +31612856453<br />
| 17th, morning, by car<br />
| 19th, evening<br />
| Don't know yet.<br />
|-<br />
| remi<br />
| Remi Turk<br />
| UvA / UU<br />
| <br />
| -<br />
| -<br />
| Don't know yet<br />
|-<br />
| npouillard (ertai)<br />
| Nicolas Pouillard<br />
| INRIA<br />
| +33680126526<br />
| 17th, morning<br />
| 19th, afternoon<br />
| B&B Utrecht<br />
|-<br />
|nominolo<br />
|Thomas Schilling<br />
|University of Kent<br />
|<br />
|16th, probably<br />
|20th<br />
|friend's place<br />
|-<br />
| waern<br />
| David Waern<br />
| Amadeus<br />
| +33 642508769<br />
| 16th<br />
| 20th<br />
| Don't know yet<br />
|}<br />
<br />
= Additional Comments =<br />
<br />
Please use this section to leave comments for other attendees, e.g. for organizing accommodation.</div>Ertaihttps://wiki.haskell.org/index.php?title=Hac5/Attendees&diff=26985Hac5/Attendees2009-03-15T16:45:30Z<p>Ertai: </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 />
| April 17 (train 9.58, a bit late, but very convenient)<br />
| April 19 (train 19.29)<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 />
| 16th 23:00<br />
| 19th 17:00<br />
| Hotel de Admiraal<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 />
| Hotel Oorsprongpark Utrecht<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 />
| 16th in the evening<br />
| 21th in the morning<br />
| Strowis<br />
|-<br />
| hesselink<br />
| Erik Hesselink<br />
| UU<br />
| +31 650994887<br />
| -<br />
| -<br />
| Lives in Utrecht<br />
|-<br />
| -<br />
| Marnix Klooster<br />
| Infor/private<br />
| -<br />
| -<br />
| -<br />
| Lives close to Utrecht<br />
|-<br />
|arjanb<br />
|Arjan Boeijink<br />
| -<br />
| -<br />
|Either the 17th or 18th in morning<br />
|19th in the evening<br />
|Not decided yet on traveling or finding a place to sleep.<br />
|-<br />
| Chatterbox<br />
| Peter Verswyvelen<br />
| Antwerp<br />
| <br />
| April&nbsp;17 in the afternoon<br />
| April&nbsp;19 in the afternoon<br />
| Apollo Hotel Utrecht City Centre<br />
|-<br />
| Beelsebob<br />
| Thomas Davie<br />
| Antwerp<br />
| <br />
| April&nbsp;17 in the afternoon<br />
| April&nbsp;19 in the afternoon<br />
| Apollo Hotel Utrecht City Centre<br />
|-<br />
| basvandijk<br />
| Bas van Dijk<br />
| Radboud Universiteit Nijmegen<br />
| +31614065248<br />
| 17th, morning, by car<br />
| 19th, evening<br />
| Don't know yet.<br />
|-<br />
|<br />
| Roel van Dijk<br />
| Radboud Universiteit Nijmegen<br />
| +31612856453<br />
| 17th, morning, by car<br />
| 19th, evening<br />
| Don't know yet.<br />
|-<br />
| remi<br />
| Remi Turk<br />
| UvA / UU<br />
| <br />
| -<br />
| -<br />
| Don't know yet<br />
|-<br />
| npouillard (ertai)<br />
| Nicolas Pouillard<br />
| INRIA<br />
| +33680126526<br />
| 17th, morning<br />
| 19th, afternoon<br />
| Strowis<br />
|}<br />
<br />
= Additional Comments =<br />
<br />
Please use this section to leave comments for other attendees, e.g. for organizing accommodation.</div>Ertaihttps://wiki.haskell.org/index.php?title=ListT_done_right&diff=26794ListT done right2009-03-01T15:18:15Z<p>Ertai: Remove an extra 'where' keyword.</p>
<hr />
<div>== Introduction ==<br />
<br />
The Haskell hierarchical libraries implement a ListT monad transformer. There are, however, some problems with that implementation.<br />
<br />
* <hask>ListT</hask> imposes unnecessary strictness.<br />
* <hask>ListT</hask> isn't really a monad transformer, ie. <hask>ListT m</hask> isn't always a monad for a monad <hask>m</hask>.<br />
<br />
See the [[#Examples]] below for demonstrations of these problems.<br />
<br />
== Implementation ==<br />
<br />
The following implementation tries to provide a replacement for the ListT transformer using the following technique. Instead of associating a monadic side effect with a list of values (<hask>m [a]</hask>), it lets each element of the list have its own side effects, which only get `excecuted' if this element of the list is really inspected.<br />
<br />
There is also a [[ListT done right alternative]].<br />
<br />
<haskell><br />
import Data.Maybe<br />
import Control.Monad.State<br />
import Control.Monad.Reader<br />
import Control.Monad.Error<br />
import Control.Monad.Cont<br />
<br />
-- The monadic list type<br />
data MList' m a = MNil | a `MCons` MList m a<br />
type MList m a = m (MList' m a)<br />
<br />
-- This can be directly used as a monad transformer<br />
newtype ListT m a = ListT { runListT :: MList m a }<br />
<br />
-- A "lazy" run function, which only calculates the first solution.<br />
runListT' :: Functor m => ListT m a -> m (Maybe (a, ListT m a))<br />
runListT' (ListT m) = fmap g m where<br />
g MNil = Nothing<br />
g (x `MCons` xs) = Just (x, ListT xs)<br />
<br />
-- In ListT from Control.Monad this one is the data constructor ListT, so sadly, this code can't be a drop-in replacement.<br />
liftList :: Monad m => [a] -> ListT m a<br />
liftList [] = ListT $ return MNil<br />
liftList (x:xs) = ListT . return $ x `MCons` (runListT $ liftList xs)<br />
<br />
instance Functor m => Functor (ListT m) where<br />
fmap f (ListT m) = ListT $ fmap (fmap f) m<br />
<br />
instance Functor m => Functor (MList' m) where <br />
fmap _ MNil = MNil<br />
fmap f (x `MCons` xs) = f x `MCons` fmap (fmap f) xs<br />
<br />
-- Why on earth isn't Monad declared `class Functor m => Monad m'?<br />
-- I assume that a monad is always a functor, so the contexts <br />
-- get a little larger than actually necessary<br />
instance (Functor m, Monad m) => Monad (ListT m) where<br />
return x = ListT . return $ x `MCons` return MNil<br />
m >>= f = joinListT $ fmap f m<br />
<br />
instance MonadTrans ListT where<br />
lift = ListT . liftM (`MCons` return MNil)<br />
<br />
instance (Functor m, Monad m) => MonadPlus (ListT m) where<br />
mzero = liftList []<br />
(ListT xs) `mplus` (ListT ys) = ListT $ xs `mAppend` ys<br />
<br />
-- Implemenation of join<br />
joinListT :: (Functor m, Monad m) => ListT m (ListT m a) -> ListT m a<br />
joinListT (ListT xss) = ListT . joinMList $ fmap (fmap runListT) xss<br />
<br />
joinMList :: (Functor m, Monad m) => MList m (MList m a) -> MList m a<br />
joinMList = (=<<) joinMList'<br />
<br />
joinMList' :: (Functor m, Monad m) => MList' m (MList m a) -> MList m a<br />
joinMList' MNil = return MNil<br />
joinMList' (x `MCons` xs) = x `mAppend` joinMList xs<br />
<br />
mAppend :: (Functor m, Monad m) => MList m a -> MList m a -> MList m a<br />
mAppend xs ys = (`mAppend'` ys) =<< xs<br />
<br />
mAppend' :: (Functor m, Monad m) => MList' m a -> MList m a -> MList m a<br />
mAppend' MNil ys = ys<br />
mAppend' (x `MCons` xs) ys = return $ x `MCons` mAppend xs ys<br />
<br />
-- These things typecheck, but I haven't made sure what they do is sensible.<br />
-- (callCC almost certainly has to be changed in the same way as throwError)<br />
instance (MonadIO m, Functor m) => MonadIO (ListT m) where<br />
liftIO = lift . liftIO<br />
<br />
instance (MonadReader s m, Functor m) => MonadReader s (ListT m) where<br />
ask = lift ask<br />
local f = ListT . local f . runListT<br />
<br />
instance (MonadState s m, Functor m) => MonadState s (ListT m) where<br />
get = lift get<br />
put = lift . put<br />
<br />
instance (MonadCont m, Functor m) => MonadCont (ListT m) where<br />
callCC f = ListT $<br />
callCC $ \c -><br />
runListT . f $ \a -> <br />
ListT . c $ a `MCons` return MNil<br />
<br />
instance (MonadError e m, Functor m) => MonadError e (ListT m) where<br />
throwError = lift . throwError<br />
{- This (perhaps more straightforward) implementation has the disadvantage<br />
that it only catches errors that occur at the first position of the <br />
list.<br />
m `catchError` h = ListT $ runListT m `catchError` \e -> runListT (h e)<br />
-}<br />
-- This is better because errors are caught everywhere in the list.<br />
(m :: ListT m a) `catchError` h = ListT . deepCatch . runListT $ m <br />
where<br />
deepCatch :: MList m a -> MList m a<br />
deepCatch ml = fmap deepCatch' ml `catchError` \e -> runListT (h e)<br />
<br />
deepCatch' :: MList' m a -> MList' m a<br />
deepCatch' MNil = MNil <br />
deepCatch' (x `MCons` xs) = x `MCons` deepCatch xs<br />
</haskell><br />
<br />
== Examples ==<br />
<br />
Here are some examples that show why the old ListT is not right, and how to use the new ListT instead.<br />
<br />
=== Sum of squares ===<br />
<br />
Here's a silly example how to use ListT. It checks if an <hask>Int</hask> <hask>n</hask> is a sum of two squares. Each inspected possibility is printed, and if the number is indeed a sum of squares, another message is printed. Note that with our ListT, runMyTest only evaluates the side effects needed to find the first representation of <hask>n</hask> as a sum of squares, which would be impossible with the ListT implementation of <hask>Control.Monad.List.ListT</hask>.<br />
<br />
<haskell><br />
myTest :: Int -> ListT IO (Int, Int)<br />
myTest n = do<br />
let squares = liftList . takeWhile (<=n) $ map (^(2::Int)) [0..]<br />
x <- squares<br />
y <- squares<br />
lift $ print (x,y)<br />
guard $ x + y == n<br />
lift $ putStrLn "Sum of squares."<br />
return (x,y)<br />
<br />
runMyTest :: Int -> IO (Int, Int) <br />
runMyTest = fmap (fst . fromJust) . runListT' . myTest<br />
</haskell><br />
<br />
A little example session (<hask>runMyTest'</hask> is implemented in exactly the same way as <hask>runMyTest</hask>, but uses <hask>Control.Monad.List.ListT</hask>):<br />
<br />
*Main> runMyTest 5<br />
(0,0)<br />
(0,1)<br />
(0,4)<br />
(1,0)<br />
(1,1)<br />
(1,4)<br />
Sum of squares.<br />
*Main> runMyTest' 5<br />
(0,0)<br />
(0,1)<br />
(0,4)<br />
(1,0)<br />
(1,1)<br />
(1,4)<br />
Sum of squares.<br />
(4,0)<br />
(4,1)<br />
Sum of squares.<br />
(4,4)<br />
<br />
=== Grouping effects ===<br />
<br />
I didn't understand the statement "<hask>ListT m</hask> isn't always a monad", even<br />
after I understood why it is too strict. I found the answer in<br />
[http://www.cse.ogi.edu/~mpj/pubs/composing.html Composing Monads]. It's in<br />
fact a direct consequence of the unnecessary strictness. <hask>ListT m</hask> is<br />
not associative (which is one of the monad laws), because grouping affects<br />
when side effects are run (which may in turn affect the answers). Consider<br />
<br />
<haskell><br />
import Control.Monad.List<br />
import Data.IORef<br />
<br />
test1 :: ListT IO Int<br />
test1 = do<br />
r <- liftIO (newIORef 0)<br />
(next r `mplus` next r >> next r `mplus` next r) >> next r `mplus` next r<br />
<br />
test2 :: ListT IO Int<br />
test2 = do<br />
r <- liftIO (newIORef 0)<br />
next r `mplus` next r >> (next r `mplus` next r >> next r `mplus` next r)<br />
<br />
next :: IORef Int -> ListT IO Int<br />
next r = liftIO $ do x <- readIORef r<br />
writeIORef r (x+1)<br />
return x<br />
</haskell><br />
<br />
Under Control.Monad.List.ListT, test1 returns the answers<br />
<hask>[6,7,8,9,10,11,12,13]</hask> while test2 returns the answers<br />
<hask>[4,5,6,7,10,11,12,13]</hask>. Under the above ListT (if all answers are forced), both return<br />
<hask>[2,3,5,6,9,10,12,13]</hask>.<br />
<br />
[[Andrew Pimlott]]<br />
<br />
=== Order of printing ===<br />
<br />
Here is another (simpler?) example showing why "<hask>ListT m</hask> isn't always a monad".<br />
<br />
<haskell><br />
a,b,c :: ListT IO ()<br />
[a,b,c] = map (liftIO . putChar) ['a','b','c']<br />
<br />
t1 :: ListT IO ()<br />
t1 = (a `mplus` a >> b) >> c<br />
<br />
t2 :: ListT IO ()<br />
t2 = a `mplus` a >> (b >> c)<br />
</haskell><br />
<br />
Under <hask>Control.Monad.List.ListT</hask>, running <hask>runListT t1</hask> prints "aabbcc", while <hask>runListT t2</hask> instead prints "aabcbc". Under the above ListT, they both print "abc" (if all answers were forced, they would print "abcabc").<br />
<br />
[[Roberto Zunino]]<br />
<br />
== Relation to Nondet ==<br />
<br />
NonDeterminism describes another monad transformer that can also be used to model nondeterminism. In fact, <hask>ListT</hask> and <hask>NondetT</hask> are quite similar with the following two functions translating between them<br />
<br />
<haskell><br />
toListT :: (Monad m) => NondetT m a -> ListT m a<br />
toListT (NondetT fold) = ListT $ fold ((return.) . MCons) (return MNil)<br />
<br />
toNondetT :: (Monad m) => ListT m a -> NondetT m a<br />
toNondetT (ListT ml) = NondetT (\c n -> fold c n ml) where<br />
fold :: Monad m => (a -> m b -> m b) -> m b -> MList m a -> m b<br />
fold c n xs = fold' c n =<< xs<br />
<br />
fold' :: Monad m => (a -> m b -> m b) -> m b -> MList' m a -> m b<br />
fold' _ n MNil = n<br />
fold' c n (x `MCons` xs) = c x (fold c n xs)<br />
</haskell><br />
<br />
<hask>ListT</hask> is smaller than <hask>NondetT</hask> in the sense that <hask>toListT . toNondetT</hask> is the identity (is it ok to call <hask>ListT</hask> `retract'?). However, these functions don't define an isomorphism (check for example <hask>NondetT (\_ n -> liftM2 const n n)</hask>).<br />
<br />
[[Thomas Jaeger]]<br />
<br />
''I propose to replace every occurence of `fmap` in the above code with `liftM`, thereby moving `class Functor` and the complaint about it not being a superclass of `Monad` completely out of the picture. I'd simply do it, if there wasn't this feeling that I have overlooked something obvious. What is it? -- [[Udo Stenzel]]''<br />
<br />
There's no particular reason why I used fmap, except that the page has the (unfortunate!) title "ListT Done Right", and having Functor superclass of Monad certainly is the right thing. But I agree, that mistake has long been done and I feel my half-hearted cure is worse than the disease. You can find an alternative, more concise definition of a ListT transformer based on even-style lists here: [[ListT done right alternative]]<br />
<br />
[[amb]] has AmbT, which could be considered as 'ListT done right' (since Amb is identical to the list monad).<br />
<br />
[[Category:Monad]]<br />
[[Category:Proposals]]</div>Ertaihttps://wiki.haskell.org/index.php?title=Twitter&diff=26779Twitter2009-02-28T18:36:12Z<p>Ertai: </p>
<hr />
<div>'''Haskell community members on Twitter'''<br />
<br />
* Bryan O’Sullivan ([http://twitter.com/bos31337 bos31337]) <br />
* Brandon Allbery ([http://twitter.com/geekosaur geekosaur]) <br />
* alpheccar ([http://twitter.com/alpheccar alpheccar])<br />
* Arnar Birgisson ([http://twitter.com/arnarbi arnarbi]) <br />
* Chris Eidhof ([http://twitter.com/chriseidhof chriseidhof]) <br />
* Conal Elliott ([http://twitter.com/conal conal]) <br />
* Conrad Parker ([http://twitter.com/conradparker conradparker]) <br />
* Don Stewart ([http://twitter.com/donsbot donsbot]) <br />
* Eelco Lempsink ([http://twitter.com/eelco eelco]) <br />
* Galois, Inc. ([http://twitter.com/galoisinc galoisinc]) <br />
* Jake McArthur ([http://twitter.com/geezusfreeek geezusfreeek]) <br />
* Pepe Iborra ([http://twitter.com/hate_pick_nick hate_pick_nick]) <br />
* John Goerzen ([http://twitter.com/jgoerzen jgoerzen]) <br />
* Eugene Kirpichov ([http://twitter.com/jkff jkff]) <br />
* Kazuya Sakakihara ([http://twitter.com/kazooya kazooya]) <br />
* Edward Kmett ([http://twitter.com/kmett kmett]) <br />
* Matthew Podwysocki ([http://twitter.com/mattpodwysocki mattpodwysocki]) <br />
* Mark Reid ([http://twitter.com/mdreid mdreid]) <br />
* Andy Adams-Moran ([http://twitter.com/morabbin morabbin]) <br />
* Neil Bartlett ([http://twitter.com/njbartlett njbartlett]) <br />
* Paul Brown ([http://twitter.com/paulrbrown paulrbrown]) <br />
* Shae Erisson ([http://twitter.com/shapr shapr]) <br />
* Sigbjorn Finne ([http://twitter.com/sigbjorn_finne sigbjorn_finne]) <br />
* Stefan Holdermans ([http://twitter.com/_dblhelix _dblhelix])<br />
* Dan Piponi ([http://twitter.com/sigfpe sigfpe]) <br />
* Spencer Janssen ([http://twitter.com/spencerjanssen spencerjanssen]) <br />
* Isaac Jones ([http://twitter.com/SyntaxPolice SyntaxPolice]) <br />
* Manuel Chakravarty ([http://twitter.com/TacticalGrace TacticalGrace]) <br />
* Tom Moertel ([http://twitter.com/tmoertel tmoertel]) <br />
* Thomas Sutton ([http://twitter.com/thsutton thsutton]) <br />
* Creighton Hogg ([http://twitter.com/wchogg wchogg]) <br />
* Jeff Wheeler ([http://twitter.com/jeffwheeler jeffwheeler])<br />
* Daniel Peebles ([http://twitter.com/pumpkingod pumpkingod], pumpkin on IRC)<br />
* Simon Marlow ([http://twitter.com/simonmar simonmar])<br />
* Andrew Wagner ([http://twitter.com/arwagner chessguy])<br />
* Magnus Therning ([http://twitter.com/magthe magthe])<br />
* Jan Xie ([http://twitter.com/flowerborn flowerborn])<br />
* Wouter Swierstra ([http://twitter.com/wouterswierstra wouterswierstra])<br />
* Tristan Allwood ([http://twitter.com/TotallyToRA TotallyToRA])<br />
* Benedict Eastaugh ([http://twitter.com/extralogical extralogical])<br />
* Alex Mason ([http://twitter.com/axman66 Axman6])<br />
* John Van Enk ([http://twitter.com/sw17ch sw17ch])<br />
* Robin Green ([http://twitter.com/greenrd greenrd])<br />
* Nicolas Pouillard ([http://twitter.com/npouillard npouillard])<br />
<br />
'''Haskell companies on Twitter'''<br />
<br />
* Galois ([http://twitter.com/galoisinc galoisinc])<br />
* Tupil ([http://twitter.com/tupil tupil])<br />
<br />
'''Haskell buzz on Twitter'''<br />
<br />
* [http://twitter.com/paytonrules/statuses/946501437 Officially amazed at the Haskell chat room. I asked a simple question there, and they went nuts on it. In a good way.]<br />
* [http://twitter.com/lallysingh/statuses/945333684 Haskell has interactive plotting commands for charts/graphs/etc. That's it, I'm officially in love]<br />
* [http://twitter.com/gimboland/statuses/944893593 God, I love Haskell]<br />
* [http://twitter.com/tsmosca/statuses/943950292 Ease of Haskell vs. Java: amazing!]<br />
* [http://twitter.com/arnax/statuses/943659297 The joy of opening a mind to Haskell :-)]<br />
* [http://twitter.com/mattpodwysocki/statuses/942618649 Aw, sweet, building a MP3 decoder in Haskell. Geek explosion ensues]<br />
* [http://twitter.com/rbp/statuses/942546816 You know, haskell actually pretty much rules :)]<br />
* [http://twitter.com/pavan_mishra/statuses/941707547 Awed by Haskell]<br />
* [http://twitter.com/clehene/statuses/939600495 I can haskell from iPhone with hugs98]<br />
<br />
[[Category:Community]]</div>Ertaihttps://wiki.haskell.org/index.php?title=Curry-Howard-Lambek_correspondence&diff=23930Curry-Howard-Lambek correspondence2008-11-09T11:08:27Z<p>Ertai: Add a missing parenthesis</p>
<hr />
<div>[[Category:Theoretical foundations]]<br />
<br />
{{Foundations infobox}}<br />
The '''Curry-Howard-Lambek correspondance''' is a three way isomorphism between types (in programming languages), propositions (in logic) and objects of a Cartesian closed [[Category theory|category]]. Interestingly, the isomorphism maps programs (functions in Haskell) to (constructive) proofs in logic (and ''vice versa''). <br />
<br />
__TOC__<br />
<br />
== Life, the Universe and Everything ==<br />
As is well established by now,<br />
<haskell>theAnswer :: Integer<br />
theAnswer = 42</haskell><br />
The logical interpretation of the program is that the type <hask>Integer</hask> is inhabited (by the value <hask>42</hask>), so the existence of this program ''proves'' the proposition <hask>Integer</hask> (a type without any value is the "bottom" type, a proposition with no proof).<br />
<br />
== Inference ==<br />
A (non-trivial) Haskell function maps a value (of type <hask>a</hask>, say) to another value (of type <hask>b</hask>), therefore, ''given'' a value of type <hask>a</hask> (a proof of <hask>a</hask>), it ''constructs'' a value of type <hask>b</hask> (so the proof is ''transformed'' into a proof of <hask>b</hask>)! So <hask>b</hask> is inhabited if <hask>a</hask> is, and a proof of <hask>a -> b</hask> is established (hence the notation, in case you were wondering).<br />
<br />
<haskell><br />
representation :: Bool -> Integer<br />
representation False = 0<br />
representation True = 1<br />
</haskell><br />
<br />
says, for example, if <hask>Boolean</hask> is inhabited, so is <hask>Integer</hask> (well, the point here is demonstration, not discovery).<br />
<br />
== Connectives ==<br />
Of course, atomic propositions contribute little towards knowledge, and the Haskell type system incorporates the logical connectives <math>\and</math> and <math>\or</math>, though heavily disguised.<br />
Haskell handles <math>\or</math> conjuction in the manner described by Intuitionistic Logic. When a program has type <math>A \or B</math>, the value returned itself indicates which one. The algebraic data types in Haskell has a tag on each alternative, the constructor, to indicate the injections:<br />
<haskell>data Message a = OK a | Warning a | Error a<br />
<br />
p2pShare :: Integer -> Message String<br />
p2pShare n | n == 0 = Warning "Share! Freeloading hurts your peers."<br />
| n < 0 = Error "You cannot possibly share a negative number of files!"<br />
| n > 0 = OK ("You are sharing " ++ show n ++ " files.")<br />
</haskell><br />
So any one of <hask>OK String</hask>, <hask>Warning String</hask> or <hask>Error String</hask> proves the proposition <hask>Message String</hask>, leaving out any two constructors would not invalidate the program. At the same time, a proof of <hask>Message String</hask> can be pattern matched against the constructors to see which one it proves.<br />
On the other hand, to prove <hask>String</hask> is inhabited from the proposition <hask>Message String</hask>, it has to be proven that you can prove <hask>String</hask> from any of the alternatives...<br />
<haskell><br />
show :: Message String -> String<br />
show (OK s) = s<br />
show (Warning s) = "Warning: " ++ s<br />
show (Error s) = "ERROR! " ++ s<br />
</haskell><br />
The <math>\and</math> conjuction is handled via an isomorphism in Closed Cartesian Categories in general (Haskell types belong to this category): <math>\mathrm{Hom}(X\times Y,Z) \cong \mathrm{Hom}(X,Z^Y)</math>. <br />
That is, instead of a function from <math>X \times Y</math> to <math>Z</math>, we can have a function that takes an argument of type <math>X</math> and returns another function of type <math>Y \rightarrow Z</math>, that is, a function that takes <math>Y</math> to give (finally) a result of type <math>Z</math>: this technique is (known as currying) logically means <math>A \and B \rightarrow C \iff A \rightarrow (B \rightarrow C)</math>.<br />
<br />
''(insert quasi-funny example here)''<br />
<br />
So in Haskell, currying takes care of the <math>\and</math> connective. Logically, a proof of <math>A \and B</math> is a pair <math>(a, b)</math> of proofs of the propositions. In Haskell, to have the final <math>C</math> value, values of both <math>A</math> and <math>B</math> have to be supplied (in turn) to the (curried) function. <br />
<br />
== Theorems for free! ==<br />
Things get interesting when polymorphism comes in. The composition operator in Haskell proves a very simple theorem.<br />
<br />
<haskell><br />
(.) :: (a -> b) -> (b -> c) -> (a -> c)<br />
(.) f g x = f (g x)<br />
</haskell><br />
<br />
The type is, actually, <hask>forall a b c. (a -> b) -> (b -> c) -> (a -> c)</hask>, to be a bit verbose, which says, logically speaking, for all propositions <hask>a, b</hask> and <hask>c</hask>, if from <hask>a</hask>, <hask>b</hask> can be proven, and if from <hask>b</hask>, <hask>c</hask> can be proven, then from <hask>a</hask>, <hask>c</hask> can be proven (the program says how to go about proving: just compose the given proofs!)<br />
<br />
== Negation ==<br />
Of course, there's not much you can do with just truth. <hask>forall b. a -> b</hask> says that given <hask>a</hask>, we can infer anything. Therefore we will take <hask>forall b. a -> b</hask> as meaning <hask>not a</hask>. Given this, we can prove several more of the axioms of logic.<br />
<br />
<haskell><br />
type Not x = (forall a. x -> a)<br />
<br />
doubleNegation :: x -> Not (Not x)<br />
doubleNegation k pr = pr k<br />
<br />
contraPositive :: (a -> b) -> (Not b -> Not a)<br />
contraPositive fun denyb showa = denyb (fun showa)<br />
<br />
deMorganI :: (Not a, Not b) -> Not (Either a b)<br />
deMorganI (na, _) (Left a) = na a<br />
deMorganI (_, nb) (Right b) = nb b<br />
<br />
deMorganII :: Either (Not a) (Not b) -> Not (a,b)<br />
deMorganII (Left na) (a, _) = na a<br />
deMorganII (Right nb) (_, b) = nb b<br />
</haskell><br />
<br />
== Type classes ==<br />
A type class in Haskell is a proposition ''about'' a [[type]]. <br />
<br />
<haskell><br />
class Eq a where<br />
(==) :: a -> a -> Bool<br />
(/=) :: a -> a -> Bool<br />
</haskell><br />
<br />
means, logically, there is a type <hask>a</hask> for which the type <hask>a -> a -> Bool</hask> is inhabited, or, from <hask>a</hask> it can be proved that <hask>a -> a -> Bool</hask> (the class promises two different proofs for this, having names <hask>==</hask> and <hask>/=</hask>). <br />
This proposition is of existential nature (not to be confused with [[existential type]]). A proof for this proposition (that there is a type that conforms to the specification) is (obviously) a set of proofs of the advertised proposition (an implementation), by an <hask>instance</hask><br />
declaration:<br />
<br />
<haskell><br />
instance Eq Bool where<br />
True == True = True<br />
False == False = True<br />
_ == _ = False<br />
<br />
(/=) a b = not (a == b)<br />
</haskell><br />
<br />
A not-so-efficient sort implementation would be:<br />
<br />
<haskell><br />
sort [] = []<br />
sort (x : xs) = sort lower ++ [x] ++ sort higher<br />
where lower = filter (<= x) xs<br />
higher = filter (> x) xs<br />
</haskell><br />
<br />
Haskell infers its type to be <hask>forall a. (Ord a) => [a] -> [a]</hask>. It means, if a type <hask>a</hask> satisfies the proposition about propositions <hask>Ord</hask> (that is, has an ordering defined, as is necessary for comparison), then <hask>sort</hask> is a proof of <hask>[a] -> [a]</hask>. For this to work, somewhere, it should be proved (that is, the comparison functions defined) that <hask>Ord a</hask> is true.<br />
<br />
== Multi-parameter type classes ==<br />
Haskell makes frequent use of multiparameter type classes. Type classes constitute a Prolog-like logic language, and multiparameter type classes define a relation between types.<br />
=== [[Functional dependencies]] ===<br />
These type level functions are set-theoretic. That is, <hask> class TypeClass a b | a -> b</hask> defines a relation between types <hask>a</hask> and <hask>b</hask>, and requires that there would not be different instances of <hask>TypeClass a b</hask> and <hask>TypeClass a c</hask> for different <hask>b</hask> and <hask>c</hask>, so that, essentially, <hask>b</hask> can be inferred as soon as <hask>a</hask> is known. This is precisely functions as relations as prescribed by set theory.<br />
<br />
== Indexed types ==<br />
''(please someone complete this, should be quite interesting, I have no idea what it should look like logically)''</div>Ertai