20 lines
505 B
Plaintext
20 lines
505 B
Plaintext
(* -*- tuareg -*- *)
|
|
|
|
module Let_syntax = struct
|
|
type 'a t = T of 'a
|
|
let map (T x) ~f = T (f x)
|
|
let both (T x) (T y) = T (x, y)
|
|
module Open_on_rhs = struct
|
|
let return x = T x
|
|
let f x ~(doc:string) = T (x, doc)
|
|
end
|
|
module Open_in_body = struct end
|
|
end
|
|
|
|
let _ = [%map_open let x = return 42 and y = f 42 in ()]
|
|
[%%expect{|
|
|
Line _, characters 45-49:
|
|
Error: This expression has type doc:bytes -> (int * bytes) Let_syntax.t
|
|
but an expression was expected of type 'a Let_syntax.t
|
|
|}]
|