Skip to content

Instantly share code, notes, and snippets.

@esad
Created January 26, 2017 19:31
Show Gist options
  • Save esad/b7ee57ce627e228fc46a012779a27075 to your computer and use it in GitHub Desktop.
Save esad/b7ee57ce627e228fc46a012779a27075 to your computer and use it in GitHub Desktop.
type Foo<'a> = Foo of string
let get (Foo key : Foo<'a>) : 'a option =
None
let set (Foo key : Foo<'a>) (value : 'a) =
()
let f = Foo "test"
set f 3
let x = get f
/// ^ Value restriction. The value 'x' has been inferred to have generic type
/// val x : '_a option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment