School of Haskell Goes Beta
fpcomplete.com
fpcomplete.com
My main issue with existing books and tutorials is that I'm left in the dark about the more interesting/advanced parts of Haskell.
Some of the areas I would like to have a better understanding:
- More advanced kinds of monads e.g. Logic, Continuation
- Monad Transformers
- Arrows
- Rank-N types
- GADTs
- Category theoretical ideas e.g. Bananas and Lenses
- Type derivatives and TypeClass abuse c.f. Conor McBride
- Control patterns like Iteratees, Generic Zippers c.f. Oleg Kiselyov, Chung-Chieh Shan
I have an intuitive grasp of the above, but to me Haskell is more about programming with types than anything functional.
On the practical side, it seems like Haskell excels as a language processor, and parsing/compilation would be a great way to explore how to structure certain kinds of applications (like web servers, graphics pipelines, etc).
Please don't make it too real-world, I already have bash ;)
I find that for a lot of higher-level ideas much of the heavy lifting isn't necessarily through application of functional ideas per se, but through more sophisticated type gymnastics.
Because expressions are often written in short-hand (to expose structure), as well abbreviated and underspecified (to get the compiler to do the work), making sense of academic code can be a challenge.
In another life I'd have dedicated more time to learning the fundamentals (of Programming Language Theory and Category Theory), because I find the whole field insanely facinating. Maybe I'm looking for a short-cut but there isn't one?
[1] http://eprints.nottingham.ac.uk/237/1/monparsing.pdf [2] http://blog.sigfpe.com/
http://www.reddit.com/r/haskell/comments/17gavl/what_you_con...
http://stackoverflow.com/questions/5778436/what-haskell-topi...
And most of those are fast moving topics these days but they're well covered in blogs, the Cafe list, stackoverflow, they just need to be collated/cataloged. At a minimum some wiki farming would address a lot of those. Unfortunately, I emailed the wiki contact a couple times about pitching in and never got response.
___________________
There's a few books you could look at, tho they're more building out what's in RWH, not up:
draft by Snoyman https://github.com/mezzohaskell/mezzohaskell
Bird's Functional algorithm pearls http://www.amazon.com/Pearls-Functional-Algorithm-Design-Ric...
http://haskell.cs.yale.edu/wp-content/uploads/2013/01/HSoM3....
JA Alonso has another book of exercises (in Spanish http://www.cs.us.es/~jalonso/publicaciones/Piensa_en_Haskell...
also the FP in Scala (Morris, Chiusano, Bjarnason) may include some haskell code, I haven't read yet, but definitely covers a lot of these hot topics
Have you tried contacting the Haskell cafe instead? I am sure someone there will be able to get through.
We also welcome good organizers (like yourself perhaps?) to write tutorials that consist partly or entirely of links to other materials. The role of editors and organizers is sometimes undervalued, but not by us!
Applicatives also compose in interesting ways as opposed to Monads.
I've lately been working on an (unpublished) project using Haskell+Yesod+Fay+Clay and it's remarkable how productive I am; in that most of my time is spent figuring out my types, writing the code, then...it's done? In Python I run into a lot of programmer related bugs that Haskell's rigid type system prevents. It can't prevent logic/flow "bugs" but it does keep a lot of other bugs out that would normally have me spending potential future hours fixing/debugging.
It's also not just the type safety that increases my productivity, it's also...Haskell. Abstraction in Haskell can make for very concise and correct programs.
Fay and Clay are particularly awesome too.
Haskell definitely has a learning curve, there was a steep curve for me and I already had significant functional programming experience (Erlang & Scheme). I'm really happy to see these guys taking that on!
Writing unit tests is not hard. Nor is it rare or exceptional. Wrestling Haskell's type system is not necessarily easy. Overall, making programs do the right thing is a big problem in any language, including Haskell, and one hopes that any system of significant size is being tested properly whether it uses a static type system or not.
The use of a type system is not in itself an objective slam dunk for Haskell over Python or anything else.
With a little extra learning curve; it beats the pants off of Python + Pyramid + unit tests and lots of extra debugging time.
I am concerned that it is forbidden even to question Haskell advocacy around here, even where it extends into pretty bald bashing of other languages.
In fact, this is so useful that new versions of GHC are going to support "type holes". If you don't know what type you need in any particular part of the code, you can just write a _ there, and the compiler will tell you what type goes there! So really, you're not spending time telling the type system which assertions to make--the type system is telling you what you need.
This is going to enable a much more interactive development style that leverages the power of the compiler to help you write your program. I think a more interactive development system is the future, and this is a good (albeit fairly small) step in that direction.
Also, as an interesting aside, the type inference can actually make your code more expressive. In both Haskell and Python, you could write a function called toString that takes an argument and returns it as a string. However, the really cool thing is that in Haskell you can write the opposite function--fromString. This function takes a string and returns a value. The real beauty is that the compiler can infer what type you need and choose the appropriate parser; in Python (or, really, virtually any other language), you would have to specify whether you want an int or a double or a Foo or a Bar explicitly.
So: the types are inferred for you, you can use these inferred types to help you write your program and they actually make the code more expressive. I think it's a pretty good deal.
Isn't your productivity gain coming from using a statically typed language rather than Haskell specifically? It feels like any statically typed language is a leg up from Python :)
I think it's a bit more than that, Haskell has a much more sophisticated type system than quite a few of the popular statically typed langauges ( C, Java, C# ). Static typing is only the start, to be really useful we need modern type inference methods and a concise way of expressing generics. Both Scala and Haskell do this very well.
It's not a profound part of writing code in Python for anybody that's spent more than a few weeks with it.
In this sense I suspect the OP would say the same about any ML-like static type system, but not many other static type systems.
but to me Haskell is a different league.. Haskell-typing actually helps /me/, where i feel C++/Java-typing merely help the compiler.
http://www.kickstarter.com/projects/150422311/screencasting-...
I just came off a largish project in Racket, and do appreciate that it's very flexible. However, I've found Haskell to be roughly as flexible in practice. Haskell has surprisingly flexible syntax and semantics, and I've found it very easy to have parts of my program with radically different semantics from normal Haskell.
You can very easily layer on things like non-determinism, logic programming, error-handling, asynchronous programming or even continuations onto Haskell code. And since it's lazy by default, you do not have to do anything special to add new control structures--you don't even need to use the macro system. (Which, of course, Racket does much better--template Haskell works, but it's a bit of a pain.)
I've also spent some time embedding DSLs in both Racket and Haskell, and have found that they are about roughly equally convenient. Racket is more flexible syntactically--it's very easy to do things like inspect variable names and the like. Haskell, on the other hand, has some very lightweight tools (laziness, do notation and a very spartan syntax) that make it very easy to change its semantics. The type system--especially things like GADTs--also makes life much easier for DSLs.
I do not know whether spartan is the right adjective. The Haskell syntax is rather bendable, but that's because you can do almost everything with the basic tools of operators and function calls. On the other hand, the Haskell syntax space is rather crowded already, and it's not trivial to add without hitting something that's already there.
- I am not convinced that it is worth it to throw out the benefits of homiconicity in order to create a distinction between code and data. I find that Haskell's heteroiconic syntax is actually harder to read and write then S-expressions.
- In mathematics all sets of the same cardinality are isomorphic. In assembly language there isn't really any notion of types besides cardinalities counted in bits. I am not convinced that we need to introduce a system of static typing besides an optional system of cardinalities. I am skeptical of the claims that we need static typing to eliminate errors and bugs.
- I am not convinced that we should have purely functional programming based upon monadic IO rather then other alternatives like uniqueness types. Perhaps a better option is to have a term rewriting and macro expansion phase that is purely functional and to encapsulate all side effects in a seperate evaluation phase.
If you are certain that Haskell's non-homoiconic syntax, static type system, and pure effects system exist in the right form for what you want to do then by all means use them. Otherwise, consider that Lisp doesn't distinguish between code and data so it gives you unprecendented freedom to shape the language into the form that suits you best.
https://haskell.fpcomplete.com/user/yogsototh/haskell-fast-h...
If you don't already have a beta account. You can try the original non interactive version here:
http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way...
I had the chance to be an alpha user of School of Haskell and I copied the tutorial to it. Clearly the interactivity provide a clear benefit.
Concerning the difficulty of my tutorial, it goes like this:
1 - very easy 2 - easy 3 - medium 4 - hard 5 - very hard 6 - annex is kind of brutal difficulty
And actually, there is at least five more level of difficulty if you want to "master" some advanced feature of Haskell.
But one thing that no tutorial is able to give, is the feeling of joy when writing Haskell. It is something you experience only when doing your firsts non trivial programs.
These are good news, I just can't wait to see that IDE.
Gregg Lebovitz talks about it here: http://www.youtube.com/watch?v=IM_OSykXKxM
I've been working my way through "Learn You a Haskell For Great Good". I worked my way up around functors and monads. Then I stopped for a while. This new School will be interesting :-)
For programming languages, it seems like a good fit to use it for rules and syntax, and the principles behind why the language works the way it does. I don't think I'll use it to ask me how to write scripts, though.
GWT, for example, has a DeferredCommand and IncrementalCommand facility for this situation. I believe they are just wrapping the setTimeout(func, 0) trick. (See link below.) If Fay does not have such a facility, then you may need to do some upstream work to teach it how.
http://b.javascript.info/tutorial/events-and-timing-depth#as...
But I guarantee that even an iPad 2 should have enough oomph to tackle your modest needs. It does just just fine on more intensive things like Google docs, spreadsheets, reader, and plus. And Facebook.
If, for example, I have not yet asked the monads tutorial to compile and run a snippet, then the browser's JS thread should be entirely quiescent and the event loop should be responsive to my zoom, pan, and rotation requests. That it isn't implicates your code (and/or the code Fay emits) — not the browser. I hope the creators of Fay considered this while architecting it. If they didn't, it's unlikely that they would have arrived at the correct solution by accident, because ordinarily compilers never need to worry about being "a good citizen" to a browser's event loop.
Best of luck. I envy that you get to work on this!
If you're already planning to learn Haskell and have a book about it, this is useful because it lets the author of the tutorial integrate the material more closely with the language environment. This makes things like little exercises to illustrate a particular point easier to do.
doubt i'll switch from scheme but still interested