Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let foo opt x fmt =
- match opt with
- | None -> assert false
- | Some f -> ksprintf (f x) fmt
- val foo : ('a -> string -> 'b) option
- -> 'a
- -> ('c, unit, string, 'b) format4
- -> 'c = <fun>
- # foo (Some (fun x s -> s)) "foo" "%s" "blah";;
- - : string = "blah"
- let bar opt x fmt =
- match opt with
- | None -> ()
- | Some f -> ksprintf (f x) fmt
- val bar : ('a -> string -> 'b) option
- -> 'a
- -> (unit, unit, string, 'b) format4
- -> unit = <fun>
- # bar (Some (fun x s -> s)) "bar" "%s" "blah";;
- Error: This function is applied to too many arguments;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement