Last active
August 16, 2024 22:34
-
-
Save voronoipotato/898f3177b1db2b5fb734a581a0d67054 to your computer and use it in GitHub Desktop.
some simple F# snippets for vscode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Place your snippets for fsharp here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "prefix": "log", | |
// "body": [ | |
// "console.log('$1');", | |
// "$2" | |
// ], | |
// "description": "Log output to console" | |
// } | |
"lambda": { | |
"prefix": ["_"], | |
"body":["(fun ${1:x} -> $0)"], | |
"description": "creates a lambda" | |
}, | |
"map": { | |
"prefix": ["_m","map"], | |
"body": ["", "|> ${TM_CURRENT_LINE/.+(List|Array|Seq|Option|Result|Map|Set).+/${1:-Seq}/}.map $0"] | |
}, | |
"bind": { | |
"prefix": ["_b","bind"], | |
"body": ["", "|> ${TM_CURRENT_LINE/.+(List|Array|Seq|Option|Result|Map|Set).+/${1:-Seq}/}.bind $0"] | |
}, | |
"filter": { | |
"prefix": ["_fi","filter"], | |
"body": ["", "|> ${TM_CURRENT_LINE/.+(List|Array|Seq|Option|Result|Map|Set).+/${1:-Seq}/}.filter $0"] | |
}, | |
"reduce": { | |
"prefix": ["_r","reduce"], | |
"body": ["", "|> ${TM_CURRENT_LINE/.+(List|Array|Seq|Option|Result|Map|Set).+/${1:-Seq}/}.reduce $0"] | |
}, | |
"collection": { | |
"prefix": "_p", | |
"body": ["", "|> ${TM_CURRENT_LINE/.+(List|Array|Seq|Option|Result|Map|Set).+/${1}/}"] | |
}, | |
"attr":{ | |
"prefix": "attr", | |
"body": ["[<${1:Literal}>]"] | |
}, | |
"module":{ | |
"prefix": "_module", | |
"body": ["module $1 =", " $0"] | |
}, | |
"xunit":{ | |
"prefix": ["_xunit","_x"], | |
"body": ["[<Fact; Trait(\"${1:Category}\", \"${2:Unit}\")>]", "let ``${3:unit test name}`` () ="] | |
}, | |
"cliMutable":{ | |
"prefix": "climutable", | |
"body": ["[<CLIMutable>]", "type ${1:Name} ="] | |
}, | |
"require qualified access":{ | |
"prefix": "require", | |
"body": ["[<RequireQualifiedAccess>]"] | |
}, | |
"k-combinator":{ | |
"prefix": "k", | |
"body": ["(fun _ -> $1)"] | |
}, | |
"holes":{ | |
"prefix": "hole", | |
"body": [ | |
"type Hole = Hole", | |
"", | |
"[<CompilerMessage(\"Incomplete hole\", 130)>]", | |
"let (?) (_ : Hole) (id : string) : 'T = ", | |
" sprintf \"Incomplete hole '%s : %O'\" id typeof<'T>", | |
" |> NotImplementedException", | |
" |> raise", | |
"", | |
"//let abs n = if n >= 0 then n else Hole ?TODO_Negation"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment