Live data from Hacker News

Type-safe GraphQL with OCaml

andreas.github.io

11–20 of 102 posts

Re: Type-safe GraphQL with OCaml

#11
post #5

Earlier quoted context omitted.

I'm hoping the movement around ReasonML[0] could lead to both the web community being able to reap the benefits of OCaml's fundamentals, while also giving people a point of introduction to the OCaml community through web dev. It has been my experience that the ReasonML community is incredibly welcoming to new comers, and is moving at a break-neck pace to find the right target of being approachable for people who are…

I really don't understand why they had to invent a brand new syntax.

to varying degree, syntax matters. (for better or worse.) the nice thing is that the semantics of ocaml haven't been changed by reasonml.

Re: Type-safe GraphQL with OCaml

#12

I wish OCaml had the libraries and community of Go or Rust, I think it'd be the most useful all-around language out there.

I wish OCaml could just use the libraries of Go and Rust. They can both compile to object files, and their type systems can be mostly modelled in OCaml's.

Re: Type-safe GraphQL with OCaml

#13
post #5

Earlier quoted context omitted.

I really don't understand why they had to invent a brand new syntax.

The short answer is that Reason's syntax is simpler and more enjoyable to use. I simultaneously learned both OCaml and ReasonML syntaxes and find Reason to be much easier to work with. Perhaps people in Reason core will chime in with a more detailed answer. Here's some official information: https://reasonml.github.io/guide/ocaml/

Yeah, I guess the complaint comes from a guy that was already familiar with OCaml's syntax.

I guess if you don't know OCaml, maybe the Reason syntax is more appealing.

Re: Type-safe GraphQL with OCaml

#14
post #10
post #7

Earlier quoted context omitted.

Probably because they were first trying to sell an ML internally and it sounded like OCaml/Bucklescript didn't catch on. I think the new syntax is the raison d'etre to some extent.

Yes, many devs know stuff with C/Java/JavaScript like syntax.

Yeah, for better or worse that's ort of the default. I think ML syntax is fine, and in some cases great. However very few CS programs seem to teach MLs and AFAICT no bootcamps do so these languages tend to get picked up by dedicated autodidacts and academics. ReasonML might be a nice bridge,

Re: Type-safe GraphQL with OCaml

#15
post #4

If ReasonML is able to form a real community, I have high hopes for its long-term prospects. Such an enjoyable language to use! I think their general approach of bootstrapping a community by lowering impedance with the JS ecosystem is a decent one. In case anyone on the OCaml team is reading this though, there are two language-level changes that I think could do wonders for wider adoption. The first is modular implic…

I think the exact opposite. Finally a language where floats and integers cannot be mixed together accidentally.

Re: Type-safe GraphQL with OCaml

#16

I wish OCaml had the libraries and community of Go or Rust, I think it'd be the most useful all-around language out there.

What exactly are you talking about? OCaml has decent libraries for almost everything that you want to do. What exactly are you missing?

Re: Type-safe GraphQL with OCaml

#17
post #12

I wish OCaml had the libraries and community of Go or Rust, I think it'd be the most useful all-around language out there.

I wish OCaml could just use the libraries of Go and Rust. They can both compile to object files, and their type systems can be mostly modelled in OCaml's.

OCaml can call external libraries via FFi functionality. I've only done this with Bucklescript (which makes it easy, the JS doesn't need to be compiled) though RWO walks through binding a C library: https://realworldocaml.org/v1/en/html/foreign-function-inter.... Wonder if this could be used with the go/rust compiler?

Re: Type-safe GraphQL with OCaml

#18
post #4

If ReasonML is able to form a real community, I have high hopes for its long-term prospects. Such an enjoyable language to use! I think their general approach of bootstrapping a community by lowering impedance with the JS ecosystem is a decent one. In case anyone on the OCaml team is reading this though, there are two language-level changes that I think could do wonders for wider adoption. The first is modular implic…

I think the exact opposite. Finally a language where floats and integers cannot be mixed together accidentally.

The type checker is capable of disallowing `float + int` while still allowing `int + int` and `float + float`, which is what I want.

Re: Type-safe GraphQL with OCaml

#19
post #17
post #12

Earlier quoted context omitted.

I wish OCaml could just use the libraries of Go and Rust. They can both compile to object files, and their type systems can be mostly modelled in OCaml's.

OCaml can call external libraries via FFi functionality. I've only done this with Bucklescript (which makes it easy, the JS doesn't need to be compiled) though RWO walks through binding a C library: https://realworldocaml.org/v1/en/html/foreign-function-inter... . Wonder if this could be used with the go/rust compiler?

It's definitely possible today, I just wish it were closer to seamless. For example, it seems like it would be possible to write a utility that takes a Go source file and emits a .cma, and maybe an .mli so you can see what's in there.
Post reply on HN