| 1 |
#print_line_numbers true |
| 2 |
|
| 3 |
module Let_syntax = struct |
| 4 |
type 'a t = T of 'a |
| 5 |
|
| 6 |
let map (T x) ~f = T (f x) |
| 7 |
let both (T x) (T y) = T (x, y) |
| 8 |
|
| 9 |
module Open_on_rhs = struct |
| 10 |
let return x = T x |
| 11 |
let f x ~(doc : string) = T (x, doc) |
| 12 |
end |
| 13 |
end |
| 14 |
|
| 15 |
let (_ : _) = |
| 16 |
[%map_open |
| 17 |
let x = return 42 |
| 18 |
and y = f 42 in |
| 19 |
()] |
| 20 |
;; |
| 21 |
|
| 22 |
[%%expect |
| 23 |
{| |
| 24 |
Line 18, characters 12-16: |
| 25 |
Error: This expression has type doc:string -> (int * string) Let_syntax.t |
| 26 |
but an expression was expected of type 'a Let_syntax.t |
| 27 |
|}] |