A set of runnable examples I'm writing and/or gathering from across the web as I learn Haskell.
A quick Haskell environment from Ubuntu repositories:
apt install ghc cabal-install haskell-stack
but cabal is seemingly old and stack is the replacement to be used preferentially, and the downloaded stack version is outdated and gives errors, so also do:
stack upgrade
An updated binary should be be created at /home/your_user/.local/bin/stack
, but I'm not entirely
sure how to use stack yet. Big TODO.
Libraries:
cabal install split regex-posix regex-pcre csv cassava aeson parsec megaparsec parser-combinators
VS Code IDE setup (TODO: Language server installation and configuration):
- "Haskell Language Server" in VS Code Extensions Marketplace
- Github Repo of Extension
TODO: Think this carefully, explain achieved progress.
- Basic language features, function definition, operators, if statements
- Command line input parsing
- Pattern matching in both function definitions and case notation
- Playing around with higher-order functions, maybe some silly things
- Using folds instead of recursion and looping
- Using the type system to create simple data structures, and the algorithms to use them
- Using the type system to create recursive data structures, and the algorithms to use them
- Parsing simple log files using the type system to check each row
- Parsing simple log files using regexes to match data instead of arbitrary string splitting
- Parsing CSV using the type system to check each row
- Parsing a simple mathematical language with only pattern matching and eval
- Parsing a simple mathematical language with parser combinators
- Parsing a simple imperative language with parser combinators
- Upenn CIS 194: Introduction to Haskell (lectures available)
- Upenn CIS 552: Advanced Programming (only homework available)
- 10 things I learnt diving in the functional programming deep end - with Haskell
- Folding (prelude): A Haskell quick start
- Folding, part 1: From recursion to folding
- Folding, part 2: From loops to folds
- Folding, part 3: Left fold, right?
- The Pragmatic Haskeller (recipes to build a simple web app to manage recipes)
- Regarding the above, the posts are actually here
- Introduction to parsing with Parsec
- Regarding, the above, discussion in Reddit