From b5ab96b6a59877107e32b8c0e1fc4b8178bbc1ce Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sat, 28 Nov 2015 00:50:02 +0000 Subject: [PATCH] Reorganise Haskell snippets --- UltiSnips/haskell.snippets | 68 -------------------------------------- snippets/haskell.snippets | 15 ++++++--- 2 files changed, 10 insertions(+), 73 deletions(-) delete mode 100644 UltiSnips/haskell.snippets diff --git a/UltiSnips/haskell.snippets b/UltiSnips/haskell.snippets deleted file mode 100644 index 419edb4..0000000 --- a/UltiSnips/haskell.snippets +++ /dev/null @@ -1,68 +0,0 @@ -priority -50 - -snippet if "if ... then ... else ..." -if ${1:condition} - then ${2:expression} - else ${3:expression} -endsnippet - -snippet case "case ... of ..." -case ${1:expression} of - ${2:pattern} -> ${3:expression} - ${4:pattern} -> ${5:expression} -endsnippet - -snippet :: "Type signature" -${1:name} :: ${2:Type} -> ${3:Type} -endsnippet - -snippet => "Type constraint" -(${1:Class} ${2:a}) => $2 -endsnippet - -snippet def "Function definition" -${1:name} :: ${2:Type} -> ${3:Type} -endsnippet - -snippet def[] "Function definition for list patterns" -${1:name} :: [${2:Type}] -> ${3:Type} -$1 [] = ${4:undefined} -$1 ${5:(x:xs)} = ${6:undefined} -endsnippet - -snippet = "Function clause" -${1:name} ${2:pattern} = ${3:undefined} -endsnippet - -snippet 2= "Function clause" -${1:name} ${2:pattern} = ${3:undefined} -$1 ${4:pattern} = ${5:undefined} -endsnippet - -snippet 3= "Function clause" -${1:name} ${2:pattern} = ${3:undefined} -$1 ${4:pattern} = ${5:undefined} -$1 ${6:pattern} = ${7:undefined} -endsnippet - -snippet | "Guard" -| ${1:predicate} = ${2:undefined} -endsnippet - -snippet \ "Lambda expression" -\\${1:pattern} -> ${2:expression} -endsnippet - -snippet [|] "List comprehension" -[${3:foo }$1 | ${1:x} <- ${2:xs} ] -endsnippet - -snippet let "let ... in ..." -let ${1:name} = ${2:expression} -in ${3:expression} -endsnippet - -snippet wh "where x = expression" -where - ${1:name} = ${2:expression} -endsnippet diff --git a/snippets/haskell.snippets b/snippets/haskell.snippets index 7f3c785..09bbc2b 100644 --- a/snippets/haskell.snippets +++ b/snippets/haskell.snippets @@ -8,7 +8,7 @@ snippet inline {-# INLINE ${0:name} #-} snippet info -- | - -- Module : ${1:Module.Namespace} + -- Module : ${1:`substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`} -- Copyright : ${2:Author} ${3:2011-2012} -- License : ${4:BSD3} -- @@ -43,8 +43,11 @@ snippet class snippet module module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` ( ) where - `expand('%') =~ 'Main' ? "\n\nmain = do\n print \"hello world\"" : ""` + `expand('%') =~ 'a' ? "\nmain :: IO ()\nmain = undefined" : ""` +snippet main + main :: IO () + main = ${0:undefined} snippet const ${1:name} :: ${2:a} $1 = ${0:undefined} @@ -54,11 +57,13 @@ snippet fn snippet fn2 ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} $1 ${5} = ${0:undefined} +snippet fn3 + ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a} + $1 ${6} = ${0:undefined} +snippet => "Type constraint" + (${1:Class} ${2:a}) => $2 snippet ap ${1:map} ${2:fn} ${0:list} -snippet do - do - snippet \ \\${1:x} -> ${0:expression} snippet (\