Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
SubTyping | Exercise 7
Prashant Basnet
Dec 12, 2024
50 views
In type theory, sub typing denoted by (<:) is a relation that describes when one type can be used in place of another type. It's more like flexible version of type equality.
The notation we are seeing is about function types and record types:
For example:
A function type A -> B means a function that takes an input of type A and returns a type B.
So when we are seeing something like:
it's asking Can a function that takes Xy and returns X be considered a subtype of a function that takes a Y and return XY?
The rules for determining this involves:
1. Contra variance of input types (domains)