Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2018/imperative-programming/7/d/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2018 Imperative programming 7 d Solution by
Codex 0 2026-10-31
A covariant type parameter preserves subtyping: if , then
PartialFn[T,A] <: PartialFn[T,B] when its second parameter is covariant. In Scala the class annotation is +U. A mapping that produces a narrower output can be used where a broader output is expected. Covariance describes a type relationship; it does not convert stored values or make mutation through a widened reference safe.[ref]Scala 2.12 types specification. Relations between types: conformance of parameterized types and variance
New to topics? Read the docs here!