Books for "advanced" Haskell

Hi all, there seems to be a huge number of things that monads can be used for. And there are lots of papers, blog posts, etc. describing that, some more or less accessible. Apart from monads there are of course also Applicative Functors, Monoids, Arrows and what have you. But in short the Monad thingy seems to be the most "powerful" one of them all. Is there a book that specializes on Monads? A Haskell-Monad book? Günther

I don't think a Haskell-monad book would be terribly interesting. A book on
taking the pieces of category theory, with a little bit more of the math, to
apply to Haskell would be greatly interesting to me.
Also a book on learning what to look for for measuring Haskell performance
in space and time + optimization seems like it'd be a good thing to have as
well.
Monad in itself is really simple. Some of the implementations of Monad can
be a little mind bending at times, but the Monad itself is not really that
complicated.
Dave
2010/3/1 Günther Schmidt
Hi all,
there seems to be a huge number of things that monads can be used for. And there are lots of papers, blog posts, etc. describing that, some more or less accessible.
Apart from monads there are of course also Applicative Functors, Monoids, Arrows and what have you. But in short the Monad thingy seems to be the most "powerful" one of them all.
Is there a book that specializes on Monads? A Haskell-Monad book?
Günther
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

2010/3/1 David Leimbach
I don't think a Haskell-monad book would be terribly interesting. A book on taking the pieces of category theory, with a little bit more of the math, to apply to Haskell would be greatly interesting to me.
Also a book on learning what to look for for measuring Haskell performance in space and time + optimization seems like it'd be a good thing to have as well.
I'd really like to read such a book! Just hacking on a project [1] for a few months have tought me a lot about writing high performance Haskell code. I imagine that one could write a decent size book on the topic by gathering the experience of a handful of experienced haske, scraping the blogosphere, and looking at the high performance libraries out there. 1. http://github.com/tibbe/event Cheers, Johan

Hello David, I do agree, Monads as *such* may not be super complicated. That said I see monads constructed by some of the Haskell big brains and used that would never ever occur to me. And then I read their papers, blog posts and everything I can get my hands on and still not get it. A shining example are Dan Piponis blog posts. Not his fault, mind. All I see is that there is something powerful. I also notice that the big brains construct monads in many different ways and thus giving them entirely different capabilities. An example of this is some techniques turn CBV to CBN or CBL while other techniques null this. I just cannot find my way through all this, in part because the information is scattered through many papers from many different authors on what does seem quite similar subjects. It's bloody confusing. So, no book, eh? Günther Am 01.03.10 16:41, schrieb David Leimbach:
I don't think a Haskell-monad book would be terribly interesting. A book on taking the pieces of category theory, with a little bit more of the math, to apply to Haskell would be greatly interesting to me.
Also a book on learning what to look for for measuring Haskell performance in space and time + optimization seems like it'd be a good thing to have as well.
Monad in itself is really simple. Some of the implementations of Monad can be a little mind bending at times, but the Monad itself is not really that complicated.
Dave
2010/3/1 Günther Schmidt
mailto:gue.schmidt@web.de> Hi all,
there seems to be a huge number of things that monads can be used for. And there are lots of papers, blog posts, etc. describing that, some more or less accessible.
Apart from monads there are of course also Applicative Functors, Monoids, Arrows and what have you. But in short the Monad thingy seems to be the most "powerful" one of them all.
Is there a book that specializes on Monads? A Haskell-Monad book?
Günther
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org mailto:Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

A shining example are Dan Piponis blog posts. Not his fault, mind. All I see is that there is something powerful. I also notice that the big brains construct monads in many different ways and thus giving them entirely different capabilities. An example of this is some techniques turn CBV to CBN or CBL while other techniques null this.
What are CBV, CBN and CBL?

2010/3/4 Matthias Görgens
A shining example are Dan Piponis blog posts. Not his fault, mind. All I see is that there is something powerful. I also notice that the big brains construct monads in many different ways and thus giving them entirely different capabilities. An example of this is some techniques turn CBV to CBN or CBL while other techniques null this.
What are CBV, CBN and CBL?
It's a series of 3 TLAs designed to make people who know what they are feel more in-the-know than those who don't. :-) Dave
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Matthias Görgens wrote:
A shining example are Dan Piponis blog posts. Not his fault, mind. All I see is that there is something powerful. I also notice that the big brains construct monads in many different ways and thus giving them entirely different capabilities. An example of this is some techniques turn CBV to CBN or CBL while other techniques null this.
What are CBV, CBN and CBL?
CBV = Call By Value, essentially strict evaluation CBN = Call By Name, essentially lazy evaluation CBL = I don't know. -- Mike

2010/3/5 Michael Vanier
CBV = Call By Value, essentially strict evaluation CBN = Call By Name, essentially lazy evaluation CBL = I don't know.
Commercial Bill of Lading? :p http://www.google.com.au/search?q=define%3ACBL -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

CBV = Call By Value, essentially strict evaluation CBN = Call By Name Call by Need = Call-by-need is a memoized version of call-by-name; essentially lazy evaluation CBL = Maybe a new acronym for Call by Need.

On Thu, Mar 4, 2010 at 7:11 PM, Richard O'Keefe
I assumed that CBL meant Call By Location
Commercial Brewer's License? I think it's about beer!
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Am 04.03.10 23:19, schrieb Matthias Görgens:
A shining example are Dan Piponis blog posts. Not his fault, mind. All I see is that there is something powerful. I also notice that the big brains construct monads in many different ways and thus giving them entirely different capabilities. An example of this is some techniques turn CBV to CBN or CBL while other techniques null this.
What are CBV, CBN and CBL?
Hi Matthias, sry for using the abbreviations. CBV = Call by Value, CBN = Call by Name, CBL = Call by Need (Lazy) Günther

Günther,
A shining example are Dan Piponis blog posts.
When you get stuck, post a comment saying where so that I can learn what people find difficult. On the other hand, I understand how intangible not-understanding can be, so it can be hard to point to where the problem is. -- Dan

Hello Dan, sorry, I did not mean to single you out, I love your stuff. But I can't find the thread through it, I pretty much lack basics / fundamentals to digest it. But I do see *power* and it bugs the crap out of me that I can't grasp it yet. One example was your response to my DSL posts on this list, where you said that in a way ever/any? monad can be considered a DSL. At that time I was totally unable to understand the sentence as such nor its significance. I kinda was focused on the "finally tagless" approach from Oleg for DSLs. Now that I do understand the significance of that statement I try to really figure it out. Mostly it finally occurred to me because of Heinrich Apfelmus's "Operational monad tutorial". Which I have no means of comprehending either because he's using GADTs. From your blog I got the impression that you focus on monads, but I may have gotten that wrong. You seem to be able to take this a very long way, without using much fancy type level arithmetic or elaborate class schemes. That gives me hope in a way because so far I'm not happy with serious type-level programming. Right now I'm reading J. Hughes '95 paper "The design of a pretty printing library" which I believe I can grasp, may even before the years end. Would you consider creating a "guide" through your blog, something like "read this first, then that"? Günther Am 06.03.10 21:14, schrieb Dan Piponi:
Günther,
A shining example are Dan Piponis blog posts.
When you get stuck, post a comment saying where so that I can learn what people find difficult.
On the other hand, I understand how intangible not-understanding can be, so it can be hard to point to where the problem is. -- Dan

Dan Piponi wrote:
Günther,
A shining example are Dan Piponis blog posts.
When you get stuck, post a comment saying where so that I can learn what people find difficult.
On the other hand, I understand how intangible not-understanding can be, so it can be hard to point to where the problem is.
I'd wager that due to wildly different backgrounds, the difficulties are also different for each person. Lately, I've been dreaming about some kind of (online-) book that covers the missing (Haskell) prerequisites in a modular fashion. I.e. when writing a blog post, you no longer have to implicitly assume / guess something about your readers' background, you can specify it explicitly, something like this module MyBlogPost where import EverythingYouKnowAboutMonoids import MonadsAsComputation import IntuitionAboutDifferentialForms import UnderstandingCurryHowards The book itself would track internal dependencies in the same fashion. Now, tracking each and every prerequisite is impossible, but some useful approximation ought to be possible. I remember a comment about people having trouble understanding monads on #haskell that might be solved by such a book thing. Namely, the main problem was that (a subset of) people simply lacked required Haskell knowledge, like having a good grasp on the distinction between type and type constructor, or being unfamiliar with Maybe. Likewise, it appears that me that a substantial fraction of the comments on RWH are actually about missing or just recently understood prerequisites. Hence, I think that tracking prerequisites explicitly has potential. Regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com

Hi All What is the state-of-the-practice in type-level programming? I know Günther started this thread about monads, but I seem to remember him having a long running problem with "typeful" database programming, and I wonder if some of his problems are really in the later area. Compared to monads, type-level programming seems much more a wild frontier - scattered docs, fewer definitive examples, no de-facto standard library. The HList paper provides an implementation of extensible records - have people found it palatable in practice? Roel van Dijk's Hackage rev-dependency page indicates only 1 package depends on it, and HaskellDB appears, at least from a cursory look, to support its own re-implementation of of HList. Best wishes Stephen

On Sun, Mar 7, 2010 at 10:53 PM, Stephen Tetley
Hi All
What is the state-of-the-practice in type-level programming?
I know Günther started this thread about monads, but I seem to remember him having a long running problem with "typeful" database programming, and I wonder if some of his problems are really in the later area. Compared to monads, type-level programming seems much more a wild frontier - scattered docs, fewer definitive examples, no de-facto standard library.
So I want the book describes how to make type-level programming up to the practice. I think this would cover how to provide simple interface for types and contexts with full benefits, how to produce friendly error message in type-errors, when to use UndecidableInstances, and how to get rid of such itchy things. -nwn

Hi Günther For advanced programming with no special attention to monads, there is 'The Fun of Programming' edited by Jeremy Gibbons and Oege de Moor, contents in a funny tab-box on this on this page: http://www.palgrave.com/products/title.aspx?PID=265581 The Haskell 'maths' books - 'The Haskell Road' (Kees Doets & Jan van Eijk) and 'Discrete Mathematics Using a Computer' (John O'Donnell, Cordelia Hall & Rex Page) - aren't guides to advanced language features, but they take somewhat vanilla functional programming (no monads, no type-classes) quite a long way. Best wishes Stephen

Excerpts from Stephen Tetley's message of Mon Mar 01 16:54:57 +0100 2010:
Hi Günther
For advanced programming with no special attention to monads, there is 'The Fun of Programming' edited by Jeremy Gibbons and Oege de Moor, contents in a funny tab-box on this on this page:
http://www.palgrave.com/products/title.aspx?PID=265581
The Haskell 'maths' books - 'The Haskell Road' (Kees Doets & Jan van Eijk) and 'Discrete Mathematics Using a Computer' (John O'Donnell, Cordelia Hall & Rex Page) - aren't guides to advanced language features, but they take somewhat vanilla functional programming (no monads, no type-classes) quite a long way.
Whatever pointers may appear here they should be put on the Haskell wiki for future reference. Marc Weber

On 2010-03-01 15:44 +0100 (Mon), Günther Schmidt wrote:
Apart from monads there are of course also Applicative Functors, Monoids, Arrows and what have you. But in short the Monad thingy seems to be the most "powerful" one of them all.
Perhaps not exactly. I build monads left and right, but that's because
I don't understand much else. :-) Before you get all hung up on them,
though, I recommend reading "The Typeclassopedia,"[1], which will
introduce you to all of the monad's friends and family.
[1]: http://byorgey.wordpress.com/2009/03/16/monadreader-13-is-out/
cjs
--
Curt Sampson

Hi, oh boy it took me a while to find this post again.
Perhaps not exactly. I build monads left and right, but that's because I don't understand much else. :-) Before you get all hung up on them, though, I recommend reading "The Typeclassopedia,"[1], which will introduce you to all of the monad's friends and family.
When you say that you use monads to the left and right, do you mean using pre-defined monad instances, or do you construct your own, ie. define something to be an instance of a monad and then write codes using that instance? Günther

2010/3/5 Günther Schmidt
When you say that you use monads to the left and right, do you mean using pre-defined monad instances, or do you construct your own, ie. define something to be an instance of a monad and then write codes using that instance?
Hi Günther One view of Monads (in the context of Haskell) is that they provide effects: - State Monad - state - Maybe monad - partiality (answer or failure) - Error monad - partiality with some answer type for the failure (variation of Maybe) - Environment monad aka Reader - read only access to "context" - Writer monad - tracing - write only access to "context" - List monad - non-determinism - Resumption monad - interleaving for (simulating) concurrency Because a monad (in the context of Haskell) is an implementation of the Monad type class and the obligation to satisfy the monad laws, there are quite few 'variations on a theme' monads e.g.: Jerzy Karczmarczuk's time travel State Monad http://users.info.unicaen.fr/~karczma/arpap/revpearl.pdf Ralf Hinze's - partial CPS monad "Typed Quote/Antiquote" -- paper currently off-line unfortunately The codensity monad - variation on the CPS monad http://www.cs.nott.ac.uk/~gmh/wrapper2.pdf Plus unique but currently rare monads, e.g: Probability http://web.engr.oregonstate.edu/~erwig/papers/PFP_JFP06.pdf These latter monads still represent effects, and one should be able to define them as transformers (I think, I haven't actually tried), but they less common presumably because people have found less need for the effects they provide. There are also monads where I'd struggle to claim any analogous 'effect' (maybe they have one and I don't understand the presentation, or maybe they don't actually have one) - generally these monads don't seem to have escaped from the mathematical world to the Haskell world. E.g. the monad of locales, power locales http://www.cs.bham.ac.uk/~mhe/papers/pinjective.pdf To work with monads in Haskell its not ignoble simple to decide what effect or combination of effects you want and use the relevant monad (for a single effect) or build a transformer (for multiple effects). Best wishes Stephen

Stephen Tetley wrote:
To work with monads in Haskell its not ignoble simple to decide what effect or combination of effects you want and use the relevant monad (for a single effect) or build a transformer (for multiple effects).
... or use the "free term algebra" approach outlined in http://apfelmus.nfshost.com/articles/operational-monad.html when the semantics of the effects are a bit tricky to fit into existing transformers. My package "operational" http://projects.haskell.org/operational/ contains a bunch of examples. Regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com

On 04/03/2010, at 8:28 PM, Curt Sampson wrote:
... I recommend reading "The Typeclassopedia,"[1], which will introduce you to all of the monad's friends and family.
[1]: http://byorgey.wordpress.com/2009/03/16/monadreader-13-is-out/
I'd love to read a book-length version of the Typeclassopedia, with more examples of applications of the various type classes, and pitched at a more ignorant reader (like myself). Tom
participants (15)
-
caseyh@istar.ca
-
Curt Sampson
-
Dan Piponi
-
David Leimbach
-
Günther Schmidt
-
Heinrich Apfelmus
-
Ivan Miljenovic
-
Johan Tibell
-
Marc Weber
-
Matthias Görgens
-
Michael Vanier
-
Richard O'Keefe
-
Stephen Tetley
-
Tom Davies
-
Yusaku Hashimoto