• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

haskell/haskell-snippets: Official collection of YASnippet Haskell snippets for ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

lukehoersten/haskell-snippets

开源软件地址(OpenSource Url):

https://github.com/haskell/haskell-snippets

开源编程语言(OpenSource Language):

YASnippet 64.9%

开源软件介绍(OpenSource Introduction):

Haskell-Snippets

Haskell-Snippets is a collection of YASnippet Haskell snippets for Emacs.

Installation

Enable the Emacs package manager and make sure the melpa package repository is set up.

(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:

(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-all

Haskell snippts should now be available to use! In a haskell-mode buffer, type fn<TAB>. A prompt should appear asking which fn snippet to expand.

I highly recommend using YASnippet with ido-mode. Configure Emacs:

(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. 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, [email protected].




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap