Haskell
Haskell is a pure-/FP language I (/who/astynax) really like and use in my projects. I write Haskell in the /Emacs or just use the REPL.
How to get and use
I use ghcup to get the GHC compiler itself, the Haskell Language Server, the Cabal tool.
Sometimes HLS wants you to do some preparation if you are planning to use it with your projects. Usually, all you need is
hie.yaml
containing this “cradle: {cabal: {}}
”. For more info go to docs for hie-bios.
In the past, I preferred the Stack tool but nowadays I’m glad to use the Cabal. Someday, I may adopt the /Nix (package manager) as a more predictable alternative/companion for Cabal. Stack, Cabal & Nix are able to run /Haskell/scripts
Parsing & stuff
The ML-like languages are very good for parsing and text processing. A bunch of languages like /Elm, /PureScript, Agda are implemented in Haskell. Some languages are using parser combinators (Parsec, Megaparsec), other ones are using /alex and happy.
Notable packages
- /Turtle (library), a shell scripting toolkit
- Threepenny-GUI, a Web /GUI framework with the FRP taste
- /haskell/shake, a declarative build system
- propellor, a configuration management system (does the same work that /Ansible does)
- Hakyll, a static site generation framework
- HsLua, binding to /Lua language. Here is a good intro and here are nice examples of usage.
- QuickCheck, the famous property-based testing framework (good intro to)
- tasty, a “Modern and extensible testing framework”
- Hspec, a testing framework with user friendly DSL (as they say) with hooks for setup/teardown (see “Hspec Hooks”)
- brick, a declarative framework for building TUI
- /haskell/wai, the Web Application Interface that helps you to build the Web-apps
- /haskell/servant, a framework for HTTP APIs
- arduino-copilot, an “Arduino programming in /Haskell using the Copilot stream DSL”
- zephyr-copilot, an “Embedded programming in haskell using the Copilot stream DSL and Zephyr”
Resources
- Hoogle (or just
!hoogle
bang in the /DuckDuckGo), the “search by types” - https://packdeps.haskellers.com/reverse shows reverse dependencies for the Hackage’s packages
- https://hackage-search.serokell.io/, a
grep(1)
like search over Hackage
Learning
- “Learn You a Haskell” book (free online version)
- kowainik/learn4haskell, “Learn Haskell basics in 4 pull requests”
- Some small but good pieces:
- “Haskell with UTF-8”, a proper way to handle IO with Unicode
- “All about strictness”: Haskell is lazy by default ad this article helps to deal with it when you need to. And this is a good addition: “Make invalid laziness unreprezentable”
- “How whitespace works in Haskell”, a very useful intro into whitespace sensitive syntax of the language. A must-watch for the beginners
Haskell powered software
- Xmonad, a tiling window manager
- /pandoc, an ultimate text conversion tool
- Shellcheck, a tool that finds bugs in your shell scripts
- hadolint, a
Dockerfile
(for /Docker) linter
Need to try
- “sydtest”, “A modern testing framework for Haskell with good defaults and advanced testing features”
Projects of mine
(notable ones :)
)