Thursday, March 14, 2013

[draft]The single critical haskell skill: Reducing code to the smallest testable/Hoogleable/REPL'able bit

OK, so you have code that doesn't typecheck, or you have code that compiles/works, but can't grok it. You have combinators, data structures, GHC language extension, you don't understand. You need to

- GHCi REPL: write minimal bits of functionality to ":load" into GHCi, [TODO, examples]

- compiler errors/warnings: read error messages you get on minimal bits (or wreck code that compiles and see what typecheck errors you get)

- type signatures read/search these in hoogle, Work on your google-fu and stackoverflow-fu.

- read Core : (save this for later) This is how you really dig in and see what's going on, but like debugging scala with "javap" bytecode, not easy.

- unit tests/BDD, QuickChecking: When you get something that works, decide what the appropriate testable unit is for your preferred style of tests


This means you need to have internalized lazy eval, associativity/precedence, and namespace/scoping rules.

Throw in extra parens if you like, to simplify associativity/precedence.


Also need to understand how GHCi operates in the IO monad and has a few syntactic differences.

- Use the GHCi page for your installed release, if not 7.6.2: haskell.org/ghc/docs/7.6.2/html/users_guide/ghci.html

- "let" without "in" for data declarations,

- you can do any top level declarations, as of 7.4.1

- GHCi keeps command history in ~/.ghc folder , ghci_history file. I haven't found an easy way to save and rerun pieces of a GHCi session, i.e. capture a transcript/log, this indicates it can't be done easily

- read you some Stackoverflow: 200+ threads tagged "GHCi"

Monday, February 11, 2013

Tips on learning [unformatted draft]

[Any questions, or categories or detail I overlooked in this post, just email me]
[TODO: nice markup, like haskell girl]

Install Platform, cabal-dev, {vim, emacs, eclipse/sublime/textmate} plugins

- Ippolito's writeup

- There's heaps of plugins for vim and emacs, the Eclipse FP project. Not so many bundles for Sublime and Txmate (yet)

- cabal-dev on hackage: In the past, has lagged latest version on github, but seems current now.

- cabal-meta + hsenv to avoid cabal hell altogether: this isn't a perfect solution if you have a lot of projects. Example snap app . I haven't heard of anybody using cabal-meta, let's call it a hibernating project.


Read good code:

reddit/SO thread, Feb 2012


Ask questions, ask for refactorings

- Where should I ask?
- Google+ Beginners community

- stackoverflow,
- Reddit/r/haskell

- IRC freenode channel,
- beginners mailing list



type signatures, and "data", "instance", "class", "type", "newtype" definition/declarations: Learn to read fluently

the wiki entry ... and ... EZYang blog

The Gentle Intro is not so gentle, goes the common complaint



Exercises:

Project Euler; Alonso, Bird and Thompson's 3 books; 99 prolog problems



Suggested first projects

Think of the analytics, data cleaning/reformatting, spider/scraping, or sysadmin tasks you normally do in python or ruby. Probably there will be easily googled examples in Haskell



GHCi REPL: Master it from the wiki:

Users guide



Space leaks, heap profiling, lazy eval

- Slides by Sergey:

- Donsbot on profiling/reduction, hunting thunk/concealed retained threads/stack etc...

- N. Mitchell on same

- Simon M on same. Frank disclosure: something that takes him a few hours is going to take you ... longer

- EZYang has some excellent posts on this

Tools:

- ghc-vis .............. hood (not sure how updated this lib is)

- heap-view

- Threadscope, HEC's, execution contexts (roughly, operating system threads)



GHC compiler internals

Scala learners, one of the trickier things is learning to read bytecode (the "javap" output), to see where inlining, tail recursive, specialization of type parameters etc happens. I'm not sure digging through Core can be made easier for Haskell/GHC, but here's a link dump:

dig into AST

read Core (not terribly easy)



Books:

Besides Learn You A and RWH (Real world haskell), which everybody knows, look at the books by Prof. Graham Hutton and Prof. Simon Thompson (co-author of the excellent OReilly Erlang text)

- list of free books

- Hudak, Haskell Music

- Exercises by J.A. Alonso in Spanish

- Updated material ....... and ........ more advanced topics for RWH?

- If I had written the index for RWH (ok, ignore the orange, red, blue and green, you get the idea)

- Bird, Functional Pearls

- Amazon's listing



Search engines,

Hoogle .... and ....... Hayoo search engine

At some point Google and github may start "symbolic operator searches" in repo's, until then, there's

- Stackoverflow search, which is pretty useful

- symbolhound, which mostly scrapes Stackoverflow

- searchco.de lets you look up usages, but you don't get explanations back, usually.

- Of course, I should mention my own hand-curated topic map/ontology, raw data and minimal rails app with Sphinx/SOLR/lucene plugins at github. (If you'd like to see updated scala, F#, clojure datasets, email me)



Other resources

- SO answer by Miani "Getting started"

- Wiki: Keywords ...... and .......... GHC lang extensions ......... and ......... GHC Pragmas ...... and ........... List of Learning Resources

- typeclassopedia

- 2010 Haskell Report (basically, the language spec)

- CS240 at Stanford: course notes (which are outstanding)

- Yorgey, Intro to Haskell, UPenn (also outstanding)

- Shukla's UVa lecture slides

- FP Complete School of Haskell: interactive exercises and IDE

- from Wash U in St. Louis ..... and ....... Breadcrums

- EZ Yang blog (basically, he read RWH and Typeclassopedia)



What inspired this: I meant to fill out this /r/scala blurb but not got around to it http://www.reddit.com/r/scala/comments/175krl/tips_for_getting_proficient_with_scala/

Tuesday, January 8, 2013

[DRAFT] how to read the Haskell firehose: Mailing List, Twitter, prismatic, Topsy, Reddit, Hnsearch, Pinboard/delicious

Prismatic is a good tool, deep recall, not great precision (in SOLR/tf-idf terms). If you're logged in, the best posts are usually clustered at top of topic feed, after reading those, use mouse scroll wheel, PageDown to endlessly pagelessly zoom to bottom, where you can "X" all the ancillary uninteresting junk to keep if out of your Profile feed. I also read the haskell feed without logging in (80 or so articles), there seems to be stuff that's not displayed when logged in.

Topsy is also pretty good. Good recall but doesn't disambiguate Haskell, Oklahoma and Eddie H/rugby players. Hit Links for last Day or Week. Some of the people listed as Experts may be worth following.

Other distillers of Twitter firehose are meh: Wefollow, Tweetscan, organic search in twitter (good precision, almost zero recall), Twitscoop, Twazzup.

Twitter search: good number of hits. Tip: do this when not signed in, get more hits


Reddit.com/r/haskell is the best subreddit. Pretty much any thread with more than 5 messages is worth reading carefully.

Pinboard has some great contributors for haskell / agda / Coq. Delicious has dwindling volume of new bookmarks. after multiple usability gaffes.


HaskellNews.org, kinda like alltop.com for haskell

Planet.Haskell.org reprints complete text of several dozen RSS feeds and is dependent on the bloggers keeping technical content separately tagged or somehow segregated. So you'll see some sysadmin, data mining, lisp/scala content. Not strictly germane but not uninteresting.

Not speaking without double negations, not making it undifficult to pin me down

HNsearch.com: worth looking at all haskell-related activity a couple times a week, decent volume of insightful posts.

Google Plus is gaining traction, with first-rate haskellers to follow. A couple recently joined Facebook, let's see how haskell Walls evolve.


Mailing list: Haskell-Cafe. Open Google Groups and read any thread that has "M < messages < N" where M is 5 or 10, N is 20 (20+ is yak shaving domain). Google Groups also lets you read, say, all of Conor/Conal/Oleg/CC's posts.

GHC commits: http://www.haskell.org/pipermail/cvs-libraries/ This is its own firehose, the Simons et al. are developing furiously. Shelarcy keeps close tabs on commit messages and GHC trac issue tracker, unfort'ly you need a native Japanese developer to deep comprehend.

Prolific tweeter for Category Theory/algebra: José A. Alonso .


IRC freenode channel: You could spend the rest of your life here, you'd be an expert on haskell and parsing broken sentences/typo's. Transcripts

Microsoft academic Search. Spend the rest of your life here, too.


Not mentioned:
• Stackoverflow/stackexchange,
• Beginners and other haskell.org lists,

Friday, August 17, 2012

Category Theory is more important than anything (with a few exceptions)

Physicists, topologists, and computer scientists are coming around, which makes the folks on that original Haskell committee look like Fripp and Eno, or maybe Coltrane and Miles and Bill Evans (without the bad habits).  Also makes programming languages except the ones with good type systems (Haskell, ML* family, Scala) look like evolutionary cul-de-sac's (especially dynamic typed (except clojure and erlang) )

Physics, Topology, Logic and Computation: A Rosetta Stone

http://golem.ph.utexas.edu/category/2012/08/categorical_unification.html

 http://golem.ph.utexas.edu/category/2012/06/the_gamification_of_higher_cat.html
Related: Dynamic problems fit to semirings and directed hypergraphs, Advanced Dynamic Programming in Semiring and Hypergraph Frameworks (Huang, 2008)