Skip to content

Instantly share code, notes, and snippets.

@milessabin
Created August 31, 2016 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milessabin/55939412017e2da20bcb9047240364f8 to your computer and use it in GitHub Desktop.
Save milessabin/55939412017e2da20bcb9047240364f8 to your computer and use it in GitHub Desktop.
scala> def narrow[T <: Singleton](t: T): T {} = t
narrow: [T <: Singleton](t: T)T
scala> narrow(23)
res1: 23 = 23
scala> var x = narrow(42)
x: 42 = 42
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment