3 ms·
> I don't know of ANY pls that require * operands be the same type. Haskell is an example, where the type of * is: (*) :: Num a => a -> a -> a Which says
by bidirectional 5y ago
> I don't know of ANY pls that require * operands be the same type.
Haskell is an example, where the type of * is:
(*) :: Num a => a -> a -> a
Which says that the arguments must be numeric, and of the same type. I think this is the sensible choice from a strongly-typed perspective, and some operation which allows one to multiply a time value should be a separate thing.
- twic 5y agoBut you can define your own * operator, separate to the one from Num, with any types you like, can't you? You might have to hide the one from the prelude to use it.