My collection of Haskell snippets for LuaSnip. Powered by tree-sitter and LSP.
[![Neovim][neovim-shield]][neovim-url] [![Lua][lua-shield]][lua-url] [![Haskell][haskell-shield]][haskell-url] [![Nix][nix-shield]][nix-url]
[![GPL2 License][license-shield]][license-url] [![Issues][issues-shield]][issues-url] [![Build Status][ci-shield]][ci-url] [![LuaRocks][luarocks-shield]][luarocks-url]
Quick Links
Installation
Use luarocks or your favourite plugin manager.
Required
neovim >= 0.8luasnip
Optional
andhaskell-tools.nvim
(some snippets work better with LSP).
- A Haskell tree-sitter parser or
nvim-treesitter
and the parser for haskell.
Quick setup
Add the following to your LuaSnip setup.
local ls = require('luasnip')
ls.setup {
-- Add your LuaSnip config
}
local haskell_snippets = require('haskell-snippets').all
ls.addsnippets('haskell', haskellsnippets, { key = 'haskell' })
[!NOTE]>
See also :h haskell-snippets
Snippets
[!NOTE]>
- The recording software ttyrec
sometimes has some visual glitches.
- Many snippets provided by this plugin use choice nodes
recursively.
Pragmas
haskell-snippets.pragmas.prag
- Trigger:
prag
haskell-snippets.pragmas.lang
- Trigger:
lang
haskell-snippets.pragmas.discover
- Trigger:
discover
haskell-snippets.pragmas.nowarn
- Trigger:
nowarn
Module and imports
haskell-snippets.module.mod
- Trigger:
mod
haskell-snippets.module.qual
- Trigger:
qual
haskell-snippets.module.impc
- Trigger:
impc - Requires a tree-sitter parser for Haskell.
haskell-snippets.module.qualc
- Trigger:
qualc - Requires a tree-sitter parser for Haskell.
Data and typeclasses
haskell-snippets.data.adt
- Trigger:
adt
haskell-snippets.data.newtype
- Trigger:
new
haskell-snippets.data.rec
- Trigger:
rec
haskell-snippets.data.cls
- Trigger:
cls
haskell-snippets.data.ins
- Trigger:
ins
haskell-snippets.data.constraint
- Trigger:
=>
Functions
haskell-snippets.functions.fn
- Trigger:
fn
haskell-snippets.functions.func
- Trigger:
func
haskell-snippets.functions.lambda
- Trigger:
\
Expressions
haskell-snippets.expressions.if_expr
- Trigger:
if
haskell-snippets.expressions.ifexprmultiline
- Trigger:
iff
- Trigger:
case
haskell-snippets.expressions.ifexprmultiway
- Trigger:
ifmw
haskell-snippets.expressions.lambdacase
- Trigger:
\case
QuasiQuotes
haskell-snippets.quasiquotes.qq
- Trigger:
qq
haskell-snippets.quasiquotes.sql
- Trigger:
sql
Contributing
All contributions are welcome! See CONTRIBUTING.md.
Recommendations
Here are some other plugins I recommend for Haskell development:
Toolset to improve the Haskell experience in Neovim. Interact with tests in neovim. Hoogle search.[neovim-shield]: https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white [neovim-url]: https://neovim.io/ [lua-shield]: https://img.shields.io/badge/lua-%232C2D72.svg?style=for-the-badge&logo=lua&logoColor=white [lua-url]: https://www.lua.org/ [nix-shield]: https://img.shields.io/badge/nix-0175C2?style=for-the-badge&logo=NixOS&logoColor=white [nix-url]: https://nixos.org/ [haskell-shield]: https://img.shields.io/badge/Haskell-5e5086?style=for-the-badge&logo=haskell&logoColor=white [haskell-url]: https://www.haskell.org/ [issues-shield]: https://img.shields.io/github/issues/mrcjkb/haskell-snippets.nvim.svg?style=for-the-badge [issues-url]: https://github.com/mrcjkb/haskell-snippets.nvim/issues [license-shield]: https://img.shields.io/github/license/mrcjkb/haskell-snippets.nvim.svg?style=for-the-badge [license-url]: https://github.com/mrcjkb/haskell-snippets.nvim/blob/master/LICENSE [ci-shield]: https://img.shields.io/github/actions/workflow/status/mrcjkb/haskell-snippets.nvim/nix-build.yml?style=for-the-badge [ci-url]: https://github.com/mrcjkb/haskell-snippets.nvim/actions/workflows/nix-build.yml [luarocks-shield]: https://img.shields.io/luarocks/v/MrcJkb/haskell-snippets.nvim?logo=lua&color=purple&style=for-the-badge [luarocks-url]: https://luarocks.org/modules/MrcJkb/haskell-snippets.nvim