Encoding for JS modules
-
Use Record to represent modules which does not expose mutable properties or you don't want to expose them.
-
Use JSObject to expose mutable properties by using Prop.
-
Type module level functions as EffectFn* in both cases.
-
Type constructor functions as ConstructorFn* in both cases.
Generic helpers
It seems that we can help generate records from both representations which gonna handle ConstructorFn* for us properly by turning it into plain effectful function which returns already preprocessed JSObject representation (mkFFI and mkNewtypedFFI).
Encoding for JS modules
Use
Recordto represent modules which does not expose mutable properties or you don't want to expose them.Use
JSObjectto expose mutable properties by usingProp.Type module level functions as
EffectFn*in both cases.Type constructor functions as
ConstructorFn*in both cases.Generic helpers
It seems that we can help generate records from both representations which gonna handle
ConstructorFn*for us properly by turning it into plain effectful function which returns already preprocessedJSObjectrepresentation (mkFFIandmkNewtypedFFI).