Haskell for python developers - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

tristanC

Hoping to get my colleagues on-board with Haskell. I wrote this article that presents examples of Haskell and Python syntax side-by-side. Please let me know if you spot any mistakes or if you would like to re-use the document.

Torsten Schmits

clever, using parentheses for function calls

Will

this is a great rundown, very concise. just a couple things:

  • typo in the imports section (hidding -> hiding)
  • trying to apply my understanding of OO classes to haskell type classes was a major sticking point for me when i was first learning haskell. I think explicit comparison to duck typing might help the concept click with a python audience; duck typing and type classes let you program to an interface (as in a collection of methods) rather than a concrete type
  • i’d add a note to the syntax section on control flow constructs (“what do I do in haskell instead of for/while/if/raise?“). recursion and haskell error handling are for sure not cans of worms you want to open here, but a gentle “haskellers use maps and folds instead of loops” and “functions which might go wrong often return a Maybe” at least signal there’s a solution

i really like the format with the side by side tables! it was surprisingly refreshing to see how close so many of these common constructs map into haskell. as the sole haskell evangelist at my company, i will definitely be linking back to this!

Will

oh, one last thing, if you suspect your audience will be doing much scripting type stuff in haskell, i'd for sure add this tutorial to the further resources section: https://www.fpcomplete.com/haskell/tutorial/stack-script/

This tutorial assumes you've already installed the Stack build tool. If you haven't yet, please start with the get started page and then come back here.
tristanC

Thank you for the prompt feedback, the import example typo should now be fixed. About OO classes and control flow, I would need more experience to provide relevant examples. I tried to stick to the things I understand in this initial post :-)

You can find a copy of the source here as well as the pandoc script I used to transform the code block into table cell.

Contribute to softwarefactory-project/www.softwarefactory-project development by creating an account on GitHub.
Simple haskell usage demo. Contribute to TristanCacqueray/haskell-playground development by creating an account on GitHub.