-
-
Save sim642/afc871eacba1622440e957e9588dc1a2 to your computer and use it in GitHub Desktop.
Goblint GADT query attempt
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
type _ t = | |
| Query1: int t | |
| Query2: bool t | |
type result = unit (* for now *) | |
type ctx = { | |
ask: 'a. 'a t -> result | |
} | |
module type S = | |
sig | |
val query: ctx -> 'a t -> result | |
end | |
module MCP: S = | |
struct | |
let rec query (ctx: ctx) (type a) (q: a t): result = | |
let ctx' = { | |
ask = (fun (type b) (q: b t) -> query ctx q) | |
(* on q above: *) | |
(* Error: This expression has type b t | |
but an expression was expected of type 'a | |
The type constructor b would escape its scope *) | |
(* why expected ['a] not ['a t]? *) | |
} | |
in | |
failwith "TODO" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment