Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haskell/haskell-snippets
Official collection of YASnippet Haskell snippets for Emacs.
https://github.com/haskell/haskell-snippets
Last synced: about 2 months ago
JSON representation
Official collection of YASnippet Haskell snippets for Emacs.
- Host: GitHub
- URL: https://github.com/haskell/haskell-snippets
- Owner: haskell
- Fork: true (lukehoersten/haskell-snippets)
- Created: 2015-05-01T17:07:38.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-28T03:44:14.000Z (over 3 years ago)
- Last Synced: 2024-04-16T00:49:06.981Z (7 months ago)
- Language: YASnippet
- Homepage:
- Size: 27.3 KB
- Stars: 12
- Watchers: 12
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Haskell-Snippets
**Haskell-Snippets** is a collection of
[YASnippet][yas]
[Haskell][haskell] snippets for Emacs.## Installation
Enable the Emacs package manager and make sure the melpa package
repository is set up.```lisp
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
```M-x package-install haskell-snippets
Add the following to your Emacs config:
```lisp
(require 'haskell-snippets)
```Snippets may have to be recompiled and reloaded in Emacs if YASnippet
is already in use:M-x yas-recompile-all
M-x yas-reload-allHaskell snippts should now be available to use! In a `haskell-mode`
buffer, type `fn`. A prompt should appear asking which `fn`
snippet to expand.I **highly** recommend using YASnippet with [ido-mode]. Configure
Emacs:```lisp
(setq-default yas-prompt-functions '(yas-ido-prompt yas-dropdown-prompt))
```This is important so that alternatives (like `import` vs. `import
qualified`) can quickly be selected with a single key stroke.## Available Expansion Keys
* `new` - newtype
* `mod` - module [simple, exports]
* `main ` - main module and function
* `let` - let bindings
* `lang` - language extension pragmas
* `opt` - GHC options pragmas
* `\` - lambda function
* `inst` - instance declairation
* `imp` - import modules [simple, qualified]
* `if` - if conditional [inline, block]
* `<-` - monadic get
* `fn` - top level function [simple, guarded, clauses]
* `data` - data type definition [inline, record]
* `=>` - type constraint
* `{-` - block comment
* `case` - case statement## Design Ideals
* Keep snippet keys (the prefix used to auto-complete) to four
characters or less while still being as easy to guess as possible.* Have as few keys as possible. The more keys there are to remember,
the harder snippets are to use and learn.* Leverage [ido-mode][] when reasonable. For instance, to keep the
number of snippet keys to a minimum as well as auto complete things
like [Haskell Langauge Extension Pragmas][lang-pragma]. When
multiple snippets share a key (ex: `fn`), the `ido-mode` prompts are
unique to one character (ex: `guarded function` and `simple
function` are `g` and `s` respectively).## Authors
This code is written and maintained by Luke Hoersten,
.[yas]: https://github.com/capitaomorte/yasnippet
[ido-mode]: http://www.emacswiki.org/emacs/InteractivelyDoThings
[lang-pragma]: http://hackage.haskell.org/packages/archive/Cabal/1.16.0.3/doc/html/Language-Haskell-Extension.html#t:KnownExtension
[haskell]: http://haskell.org/