News for hackers. Stuff that matters.
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”.
Re:Type-safe GraphQL with OCaml by masklinn on Friday December 01, 2017 @07:02AM (#15823333)
> 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)

Re:Type-safe GraphQL with OCaml by kbenson on Friday December 01, 2017 @12:29AM (#15822133)
Yeah, that's what I was referring to by explicitly converting one operand so they are like types. I too would prefer this in a language that takes typing of this sort seriously.