3 ms·
Intuitively, `a -> b` is normally interpreted as "from `a`, I can get `b`". A function of type `Int -> String` allows you to get a `String` from an `Int`. The
by maxdamantus 7y ago
Intuitively, `a -> b` is normally interpreted as "from `a`, I can get `b`".
A function of type `Int -> String` allows you to get a `String` from an `Int`.
The proposition `A -> B` (`A` implies `B`) means that `A` being true allows `B` to be true; we can deduce `B` from `A`.
For the link between functions and implication, see: https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspon...
I don't think it makes sense to say `fn read(s: string) -> int` as in Rust though. If an arrow were used in such a function declaration, it should probably look something more like:
fn read: (s: string) -> int
As another commenter has indicated, `fn read(s: string): int` states that `read(s)` is of type `int`, which is logical.