Skip to content

Instantly share code, notes, and snippets.

@aaronpowell aaronpowell/foo.fsx
Last active Jun 21, 2016

Embed
What would you like to do?
Generic record type
let foo = (bar: 'a) ->
{ something: bar }
let baz = foo(1)
let baz2 = foo("a")
printf "bar: %d" baz.bar
printf "bar2: %s" baz2.bar
@rodrigovidal

This comment has been minimized.

Copy link

commented Jun 21, 2016

type Foo<'a> = { Something : 'a }

let baz = { Something = 1 }

let baz2 = { Something = "a" }

@aaronpowell

This comment has been minimized.

Copy link
Owner Author

commented Jun 21, 2016

Yep that's what I got to, working nicely

@rodrigovidal

This comment has been minimized.

Copy link

commented Jun 21, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.