• KindaABigDyl@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    7 months ago

    In Rust and Haskell you have to at least annotate the parameter types and return type of functions.

    In OCaml type inference is a lot more powerful: you don’t have to annotate function signatures

    Actually, Haskell and OCaml have this in common. Only Rust requires parameter types of the three.

    I could do

    add2 a b = a + b
    main = do
        putStrLn $ "5 + 3 = " ++ (show $ add2 5 3)
    

    And that would work