On Tuesday, 24 January 2017 01:26:49 UTC+7, OvermindDL1 wrote:
>
> Bucklescript de-curries as much as possible, however you can also force it 
> in the type system explicitly by adding the annotation type of `[@bs]` to a 
> function (type) definition, that enforces uncurrying at the type level and 
> will even propagate in usage as expected to make sure accidental currying 
> of it is not done (though you can still explicitly curry it by wrapping it 
> in a curried type).  In most cases it de-curries very well and you never 
> need to use `[@bs]` (the only real time I've used it is on DOM callback 
> registrations with more than one argument to make sure I do not 
> accidentally pass a curried version to one, never used it in 'user' code as 
> of yet).
>

Yes, I've used the {@bs} notation, usually on very low-level code to force 
no currying (or passing of any arguments); as you say BuckleScript is very 
good of determining an appropriate use of currying.  If one were to use an 
Elm front end to OCaml/BuckleScript, it would be nice to add the ability to 
inject these macro-type annotations into the code, probably as a specially 
formed comment, so that in effect we could write all the Native code 
modules in the high level environment, which works very well in 
BuckleScript.

One thing that BuckleScript does by default that breaks type safety is not 
do array bounds checks, but that wouldn't be a problem for an Elm front end 
as Elm does not use (mutable) arrays directly.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to