ocaml을 배우려고하는데 함수 작성 연산자 인 |>에 문제가 있습니다. Ocaml 함수 응용 연산자가 실패합니다.
utop # #require "core";;
utop # open Core;;
utop # Option.value_exn(Some(1));;
- : int = 1
utop # Some(1) |> Option.value_exn;;
Error: This expression has type
?here:Base__Source_code_position0.t ->
?error:Base.Error.t -> ?message:string -> 'a option -> 'a
but an expression was expected of type int option -> 'b
나는
x |> f
이
f(x)
에 해당 있어야했다 thoght.
Option.value_exn(Some(1))
은 작동하지만
Some(1) |> Option.value_exn
은 작동하지 않는 이유는 무엇입니까?
선택적 인자'? here'처럼 보이는데,'? error'와'? message'가 방해가되고 있습니다. 'Some (1) |> fun x -> Option.value_exn x ;;'를 시도해보십시오. – gallais