haskell.snippets 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. snippet lang
  2. {-# LANGUAGE ${1:OverloadedStrings} #-}
  3. snippet info
  4. -- |
  5. -- Module : ${1:Module.Namespace}
  6. -- Copyright : ${2:Author} ${3:2011-2012}
  7. -- License : ${4:BSD3}
  8. --
  9. -- Maintainer : ${5:email@something.com}
  10. -- Stability : ${6:experimental}
  11. -- Portability : ${7:unknown}
  12. --
  13. -- ${8:Description}
  14. --
  15. snippet import
  16. import ${1:Data.Text}
  17. snippet import2
  18. import ${1:Data.Text} (${2:head})
  19. snippet importq
  20. import qualified ${1:Data.Text} as ${2:T}
  21. snippet inst
  22. instance ${1:Monoid} ${2:Type} where
  23. ${3}
  24. snippet type
  25. type ${1:Type} = ${2:Type}
  26. snippet data
  27. data ${1:Type} = ${2:$1} ${3:Int}
  28. snippet newtype
  29. newtype ${1:Type} = ${2:$1} ${3:Int}
  30. snippet class
  31. class ${1:Class} a where
  32. ${2}
  33. snippet module
  34. module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (
  35. ) where
  36. `expand('%') =~ 'Main' ? "\n\nmain = do\n print \"hello world\"" : ""`
  37. snippet const
  38. ${1:name} :: ${2:a}
  39. $1 = ${3:undefined}
  40. snippet fn
  41. ${1:fn} :: ${2:a} -> ${3:a}
  42. $1 ${4} = ${5:undefined}
  43. snippet fn2
  44. ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
  45. $1 ${5} = ${6:undefined}
  46. snippet ap
  47. ${1:map} ${2:fn} ${3:list}
  48. snippet do
  49. do
  50. snippet λ
  51. \${1:x} -> ${2}
  52. snippet \
  53. \${1:x} -> ${2}
  54. snippet <-
  55. ${1:a} <- ${2:m a}
  56. snippet ←
  57. ${1:a} <- ${2:m a}
  58. snippet ->
  59. ${1:m a} -> ${2:a}
  60. snippet →
  61. ${1:m a} -> ${2:a}
  62. snippet tup
  63. (${1:a}, ${2:b})
  64. snippet tup2
  65. (${1:a}, ${2:b}, ${3:c})
  66. snippet tup3
  67. (${1:a}, ${2:b}, ${3:c}, ${4:d})
  68. snippet rec
  69. ${1:Record} { ${2:recFieldA} = ${3:undefined}
  70. , ${4:recFieldB} = ${5:undefined}
  71. }
  72. snippet case
  73. case ${1:something} of
  74. ${2} -> ${3}
  75. snippet let
  76. let ${1} = ${2}
  77. in ${3}
  78. snippet where
  79. where
  80. ${1:fn} = ${2:undefined}