Skip to content

Instantly share code, notes, and snippets.

@sim642
Created May 6, 2021 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sim642/afc871eacba1622440e957e9588dc1a2 to your computer and use it in GitHub Desktop.
Save sim642/afc871eacba1622440e957e9588dc1a2 to your computer and use it in GitHub Desktop.
Goblint GADT query attempt
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