2 ms·
>Haskell requires that the two operands and the resultant type share a type. Most physical unit libraries simply describe a "unit-ed" multiplication/division/e
by wyager 12y ago
>Haskell requires that the two operands and the resultant type share a type.
Most physical unit libraries simply describe a "unit-ed" multiplication/division/etc operator, so you write code like
let v = (5 ~* meter) / (1 *~ second)
This division operator would replace the standard one.
This requires using Haskell extensions that support dependent types, but the libraries certainly exist.
I've used "Dimensional" before.
- Guvante 12y agoCertainly avoiding using naked `*` avoids the problem, I was talking specifically about that operator.