Created
February 5, 2016 12:09
-
-
Save dsyme/a02b19b9e55ab392a06d to your computer and use it in GitHub Desktop.
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
type Animal() = class end | |
type Dog() = inherit Animal() | |
let feed (animals: seq<Animal>) = () | |
feed [ Dog(); Animal() ] |
But
let myDogs:seq<Animal> = [ Dog(); Animal() ]
doesn't compile and I find that highly irritating
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works indeed, but unfortunately it prevents other use cases which would be allowed by using
seq<#Animal>
:unless we open the can of worms of co/contravariant type parameters :-)