Emacs: Haskell snippets for YASnippet

Hi List, this is rather trivial, but maybe someone else finds these useful: darcs get http://code.haskell.org/~daniels/haskell-snippets/ Especially the LANGUAGE ones have saved me quite some typing :) Additions welcome. Usage: If not already installed, get YASnippet: http://code.google.com/p/yasnippet/ and put this into your .emacs: (load-file "some-path/haskell-snippets.el") to expand a snippet, just enter the macro string (these are listed in the haskell-snippets.el file) and press <tab>. If the snippet has holes, press <tab> again to jump to the next hole. Greetings, Daniel

2009/11/4 Daniel Schüssler
Hi List,
this is rather trivial, but maybe someone else finds these useful:
darcs get http://code.haskell.org/~daniels/haskell-snippets/
Especially the LANGUAGE ones have saved me quite some typing :) Additions welcome.
Usage: If not already installed, get YASnippet: http://code.google.com/p/yasnippet/
and put this into your .emacs:
(load-file "some-path/haskell-snippets.el")
to expand a snippet, just enter the macro string (these are listed in the haskell-snippets.el file) and press <tab>. If the snippet has holes, press <tab> again to jump to the next hole.
Greetings, Daniel _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Cool stuff, I will probably be using this! In my opinion, the naming convention is a bit inconsistent. Extension snippets all begin with "-x" but imports begin with "imp". I'd prefer seeing import snippets begin with "-i" and use names easier to remember, e.g. instead of "impcms", use "-istate" and instead of "impdm.Map" use "-imap", etc. At least consider it! :) And about the "bot" -> "⊥" rule... Is ⊥ really valid Haskell? -- Deniz Dogan

Cool stuff, I will probably be using this!
Hi Deniz, thanks :)
In my opinion, the naming convention is a bit inconsistent. Extension snippets all begin with "-x" but imports begin with "imp". I'd prefer seeing import snippets begin with "-i" and use names easier to remember, e.g. instead of "impcms", use "-istate" and instead of "impdm.Map" use "-imap", etc. At least consider it! :)
Ah, the rationale behind the "-x" was that these are also GHC command line flags ;) But I also like "-i" better than "imp". About the names: In one sense the current scheme is easier to remember because the abbreviation can be deduced from the module name. But I suppose you're right and "state" etc. are still easier to remember in practice, so feel free to send in a patch.
And about the "bot" -> "⊥" rule... Is ⊥ really valid Haskell?
Well yes, but it's an operator name token, so valid haskell would be: x ⊥ y = x + y or (⊥) = undefined with this use as a constant you'd have to use the parentheses every time, so it probably isn't very useful indeed. Greetings, Daniel

this is rather trivial, but maybe someone else finds these useful:
darcs get http://code.haskell.org/~daniels/haskell-snippets/
Since Emacs already comes bundled with several template systems (at least skeleton.el and tempo.el, where the first seems to be marginally more "canonical"), I think it would be better to define your templates using skeleton and thus remove the dependency on yasnippet. Stefan

2009/11/4 Stefan Monnier
this is rather trivial, but maybe someone else finds these useful:
darcs get http://code.haskell.org/~daniels/haskell-snippets/
Since Emacs already comes bundled with several template systems (at least skeleton.el and tempo.el, where the first seems to be marginally more "canonical"), I think it would be better to define your templates using skeleton and thus remove the dependency on yasnippet.
Stefan
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
You guys sure have been good at hiding skeleton.el... The impression I've gotten from a couple of years in #emacs is that yasnippet is the way to go. I'll translate my own snippets to skeleton a.s.a.p. :P -- Deniz Dogan
participants (3)
-
Daniel Schüssler
-
Deniz Dogan
-
Stefan Monnier