-
-
Save ELLIOTTCABLE/8cf51f2af70dca62fcdcf7bc9fef0ea4 to your computer and use it in GitHub Desktop.
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
let smth ?(m=5) ?(n=5) ?(o=5) ~p = m+n+o+p | |
let with_z_instead : z:int -> (?m:int -> ?n:int -> 'a) -> 'a = fun ~z fn -> | |
fn ~m:z ~n:z | |
let _ = | |
let first = smth ~m:1 ~n:2 (* no ~o *) ~p:3 in | |
let second = with_z_instead ~z:4 smth (* no ~o *) ~p:123 in | |
(first, second) | |
(* | |
494 | let second = with_z_instead ~z:4 smth (* no ~o *) ~p:123 in | |
^^^^ | |
Error: This expression has type ?m:int -> ?n:int -> ?o:int -> p:int -> int | |
but an expression was expected of type ?m:int -> ?n:int -> p:'a -> 'b | |
Type ?o:int -> p:int -> int is not compatible with type p:'a -> 'b | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment