haskell.js 2.4 KB

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