In Haskell, it is considered good practice to explicitly declare the type signature of your functions, even though it can (usually) be inferred. It seems like this isn't even possible in OCaml, e.g.
val add : int -> int -> int ;;
gives me an error. (Although I can make type
modules which give only signatures.)
- Am I correct in that this isn't possible to do in OCaml?
- If so, why? The type system of OCaml doesn't seem that incredibly different from Haskell.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…