Created
August 18, 2023 12:07
-
-
Save Octachron/f813cce9d11b19062fb3c3b8e6321869 to your computer and use it in GitHub Desktop.
Contravariance and type equations
This file contains 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
module type pair = sig type a type b end | |
module type S = functor (Pair:sig include pair type b = a end) -> sig | |
open Pair | |
type either = Left of a | Right of b | |
end | |
module R = struct | |
type a = A | |
type b = a | |
end | |
module F(Make: S) = struct | |
module Mk = Make | |
module E = Mk(R) | |
let r = E.[Left A; Right A ] | |
end | |
module Pair(X:pair) = struct | |
open X | |
type either = Left of a | Right of b | |
end | |
module Ok = F(Pair) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment