8 ms·
In Haskell, and I assume Scala, you can name types of the same form, so I might say a TimeSeries is a list of floating point values. If I use that data type, yo
by jacobgreenleaf 13y ago
In Haskell, and I assume Scala, you can name types of the same form, so I might say a TimeSeries is a list of floating point values. If I use that data type, you can't accidentally pass a different kind of list of floating points even though they're the same type.
- p4lindromica 13y agoYes, you can do this in scala with type aliases
- lmm 13y agoType aliases don't solve that problem. You need to use something like Shapeless' newtype.
- kasey_junk 13y agoType aliases do not solve this. The closest you can get is using the new value classes & those have some very big caveats