Transitioning from Python to Haskell
Enjoyers of Python often describe the language as “executable pseudocode” – That is to say that the code closely resembles what one might write on a whiteboard. We might suggest that the phrase just as aptly describes Haskell, which was designed in the 1980s in part to serve as a standard language for code presented in papers. If you are trained in languages like Python, Java, or C, Haskell probably does not look like pseudocode you would write! But with some familiarity, that may change.
These lessons present Haskell in terms of its similarities and differences from Python to help Python coders jump quickly into Haskell.
Iterators
The Iterators series compares Python iterators to Haskell’s list datatype, taking a deep dive into the itertools
library and the corresponding functions in the Haskell standard library.
Other lessons
Decorators – In Python, we can preface a function with a decorator (a line beginning with @
) to make some kind of tweak or assign some extra meaning to the decorated function. Although Haskell does not have a specific language feature that mirrors Python decorators, there are a lot of examples in Haskell that follow the same pattern.
Data classes – The primary role of a Python data class is to simply hold the values that were passed as constructor arguments. This feature strongly resembles Haskell datatypes, particularly when we use Haskell’s record syntax.