Re:Type-safe GraphQL with OCaml
by baddox on Thursday November 30, 2017 @11:39PM
(#15821953)
Couldn’t the type system still allow using the + operator, but requiring the values on both sides to have the same type? You could do more magic like having int + float return a float, but I’d even prefer typing “int.toFloat + float” than “int +. float”.
[ Parent
| on HN ]
> Couldn’t the type system still allow using the + operator, but requiring the values on both sides to have the same type?
'course it could, multiple languages already do that e.g. Rust (https://play.rust-lang.org/?gist=530fa94d3f451e896ac0d3ddeaf...), Haskell (https://repl.it/repls/FrozenBlondUmbrellabird), Swift (https://repl.it/repls/LuckyNaiveBream)