jonsterling/Vinyl — pull request #11 by jonsterling (2012-10-30 20:00:27+00:00)
Title: Subtyping relation is defined only over records (close #3)

The subtyping relation `(<:)` now takes as its arguments two record types (rather than lists of fields). This makes it easier to express desired constraints in real code, since the following is now allowed:

````haskell
type Dog = Rec ["name" ::: String, "age" ::: Int]
blorg :: (r <: Dog) => r -> (String,Int)
blorg = (,) <$> rGet name <*> rGet age
````

By requiring real witnesses of the subtyping relation (that is, a witness that the fields of the subtype are a superset of the fields of the supertype), we also gain for free the advantage of `(<:)` being a closed class: it is a type error for it to be defined for anything other than records.

This is because the `IsSubtype` constraint family is only defined over records, and it is not exported (so nobody can create any further instances).