Created
November 1, 2019 13:40
-
-
Save nyaray/3112c0300e42732f3241d138c7431770 to your computer and use it in GitHub Desktop.
Explaining parts of F#
This file contains 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
let mergeStrings a b c = // string -> (string -> (string -> string)) | |
a + b + c | |
let test = mergeStrings "foo" "bar" | |
printfn "%A" (test "kalle") | |
printfn "%A" ("foo", 2) | |
//[<CLIMutable>] | |
type Dep = { | |
getIt : string -> string | |
kind : string | |
} | |
with | |
member this.getKind = this.kind | |
type Dep | |
with | |
member this.getConstant = 3 | |
let doWork (d: Dep) param : string = | |
d.getConstant |> printfn "herro %d" | |
printfn "%A" d | |
d.getIt param | |
let work = | |
doWork { | |
getIt = fun x -> "I am dep. You are: " + x | |
kind = "hardcoded" } | |
work "teh win" | |
|> (printfn "work result: %s") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment