On Thursday, 28 July 2016 20:42:44 UTC+2, John Bugner wrote:
>
> (5) Perhaps compound unit types like "Time^2" would be supported, so a 
> "Time * Time" would yield "Time^2", "Time * Float" would yield "Time", and 
> "Time * Length" would yield just that: "Time * Length". ("Force" would be 
> an alias of "Mass * Length / (Second^2)".)
>

Here's how Julia handles this, although it seems to require hand-coding all 
of of the promotion rules:

http://docs.julialang.org/en/release-0.4/devdocs/promote-op/

(understanding this may require a bit of understanding Julia's type system, 
which lets you define your own types down to the bit-level 
<http://docs.julialang.org/en/release-0.4/manual/types/>, complete with custom 
conversion and promotion rules 
<http://docs.julialang.org/en/release-0.4/manual/conversion-and-promotion/>)

Not sure how that might translate to Elm's type system, but I guess using 
custom infix operators will be part of it (except for not allowing 
redefining the built-in ones). Off-topic, but is this really all 
documentation available on infix operators? Because I don't really think 
that's good enough:

http://elm-lang.org/docs/syntax#infix-operators 

-- 
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