mirror of
https://github.com/rafamadriz/friendly-snippets
synced 2024-09-16 22:14:02 +02:00
162 lines
4.5 KiB
JSON
162 lines
4.5 KiB
JSON
{
|
|
"case": {
|
|
"prefix": ["case"],
|
|
"body": [
|
|
"case ${1:expression} of",
|
|
"\t${2:case1} -> ${3:result}",
|
|
"\t${4:case2} -> ${5:result}$0"
|
|
],
|
|
"description": "Case statement"
|
|
},
|
|
"block_comment": {
|
|
"prefix": ["--", "comment", "block_comment"],
|
|
"body": ["{- $0 -}"],
|
|
"description": "Block Comment"
|
|
},
|
|
"data_inline": {
|
|
"prefix": ["data inline"],
|
|
"body": ["data ${1:type} = ${2:data}$0 ${3:deriving (${4:Show, Eq})}"],
|
|
"description": "Inline data"
|
|
},
|
|
"data_record": {
|
|
"prefix": ["data record"],
|
|
"body": [
|
|
"data ${1:Type} = $1",
|
|
"\t{ ${2:field} :: ${3:Type}",
|
|
"\t, ${4:field} :: ${5:Type}$0",
|
|
"\t} ${6:deriving (${7:Show, Eq})}"
|
|
],
|
|
"description": "Data record"
|
|
},
|
|
"fn": {
|
|
"prefix": ["fns", "simple function"],
|
|
"body": [
|
|
"${1:f} :: ${2:a} ${3:-> ${4:b}}",
|
|
"$1 ${5:x} = ${6:undefined}$0 "
|
|
],
|
|
"description": "Simple function"
|
|
},
|
|
"fn_clause": {
|
|
"prefix": ["fnc", "clause function"],
|
|
"body": [
|
|
"${1:f} :: ${2:a} ${3:-> ${4:b}}",
|
|
"$1 ${5:pattern} = ${7:undefined}",
|
|
"$1 ${6:pattern} = ${8:undefined}$0"
|
|
],
|
|
"description": "Clause function"
|
|
},
|
|
"fn_guarded": {
|
|
"prefix": ["fng", "guarded function"],
|
|
"body": [
|
|
"${1:f} :: ${2:a} ${3:-> ${4:b}}",
|
|
"$1 ${5:x}",
|
|
"\t| ${6:condition} = ${8:undefined}",
|
|
"\t| ${7:condition} = ${9:undefined}$0"
|
|
],
|
|
"description": "Guarded function"
|
|
},
|
|
"fn_where": {
|
|
"prefix": ["fnw", "where function"],
|
|
"body": [
|
|
"${1:f} :: ${2:a} ${3:-> ${4:b}}",
|
|
"$1 ${5:x} = ${6:undefined}$0",
|
|
"\twhere",
|
|
"\t\t${7:exprs}"
|
|
],
|
|
"description": "Function with where"
|
|
},
|
|
"get": {
|
|
"prefix": ["get"],
|
|
"body": ["${1:x} <- ${2:undefined}$0"],
|
|
"description": "Monadic get"
|
|
},
|
|
"if_inline": {
|
|
"prefix": ["if inline"],
|
|
"body": [
|
|
"if ${1:condition} then ${2:undefined} else ${3:undefined}$0,"
|
|
],
|
|
"description": "If inline"
|
|
},
|
|
"if": {
|
|
"prefix": ["if simple"],
|
|
"body": [
|
|
"if ${1:condition}",
|
|
"\tthen ${2:undefined}",
|
|
"\telse ${3:undefined}$0"
|
|
],
|
|
"description": "If block"
|
|
},
|
|
"import": {
|
|
"prefix": ["import simple"],
|
|
"body": ["import ${1:module} ${2:(${3:f})}$0"],
|
|
"description": "Simple import"
|
|
},
|
|
"import_qualified": {
|
|
"prefix": ["import qual"],
|
|
"body": ["import qualified ${1:module} as ${2:name}"],
|
|
"description": "Qualified import"
|
|
},
|
|
"instance": {
|
|
"prefix": ["inst"],
|
|
"body": [
|
|
"instance ${1:Class} ${2:Data} where",
|
|
"\t${3:f} = ${4:undefined}$0"
|
|
],
|
|
"description": "typeclass instance"
|
|
},
|
|
"lambda": {
|
|
"prefix": ["\\", "lambda"],
|
|
"body": ["\\${1:x} -> ${2:undefined}$0"],
|
|
"description": "lambda function"
|
|
},
|
|
"pragma": {
|
|
"prefix": ["lang"],
|
|
"body": ["{-# LANGUAGE ${1:extension} #-}$0"],
|
|
"description": "Language extension pragma"
|
|
},
|
|
"let": {
|
|
"prefix": ["let"],
|
|
"body": ["let ${1:x} = ${2:undefined}$0"],
|
|
"description": "let statement"
|
|
},
|
|
"main": {
|
|
"prefix": ["main"],
|
|
"body": [
|
|
"module Main where",
|
|
"",
|
|
"",
|
|
"main :: IO ()",
|
|
"main = do",
|
|
"\t${1:undefined}$0",
|
|
"return ()"
|
|
],
|
|
"description": "main module"
|
|
},
|
|
"module": {
|
|
"prefix": ["mods", "mod simple"],
|
|
"body": ["module ${1:mod} where$0"],
|
|
"description": "simple module"
|
|
},
|
|
"module exports": {
|
|
"prefix": ["modu", "mod exports"],
|
|
"body": [
|
|
"module ${1:mod} (",
|
|
"\t\t${2:export}",
|
|
"\t${3:, ${4:export}}",
|
|
") where$0"
|
|
],
|
|
"description": "simple module with exports"
|
|
},
|
|
"newtype": {
|
|
"prefix": ["new"],
|
|
"body": [
|
|
"newtype ${1:Type} ${2:a} = $1 { un$1 :: ${3:a} } ${4:deriving (${5:Show, Eq})}$0"
|
|
],
|
|
"description": "Newtype definition"
|
|
},
|
|
"opt pragma": {
|
|
"prefix": ["opt"],
|
|
"body": ["{-# OPTIONS_GHC ${1:opt} #-}$0"],
|
|
"description": "GHC options pragma"
|
|
}
|
|
}
|