Hello. When using rescript-webapi I’m getting this error:
This has type: Webapi__Fetch.readableStream
Webapi.ReadableStream.t (defined as Webapi__ReadableStream.t)
Shouldn’t these types be regarded as equal?
Basically I’m trying to use the “exported api” instead of “internal modules” as normally suggested and I’m wondering if this is a bug, some quirk of the system or more probably something obvious I’m missing
The interface defines what is public, so because it’s a “phantom” type in the interface, that controls what other modules see. Said another way, being able to omit the type implementation from the .resi is a feature to hide the implementation from other modules. This enables a lot of useful behavior, like enforcing all values of that type in the codebase be constructed through a parse function that handles edge cases. (for example)
Gee…this get’s exoteric way to fast for me :-
Also not having a background in IT also doesn’t help much.
I tried looking at haskell and ocaml but the syntax alone made my head spin.
Is there any “for dummies” documentation about these type theory stuff suitable for someone way too old and dumb to learn a new syntax? Any rescript repository with standard examples?
Thanks for trying to thought…
There are lot’s of types like that in the code…since it’s something so simple I’ll let him do the PR…maybe there should be a lot more changed.
All this duplication is kind 'of a bummer though :-
Are there any ideas to streamline this in the language or is it just not worth it?