3 ms·
> Not sure what you mean by separating lines from rows. It's the example Joe Spolsky used on the blog post about prefixes that everybody keeps pointing to. He
by marcosdumay 11y ago
> Not sure what you mean by separating lines from rows.
It's the example Joe Spolsky used on the blog post about prefixes that everybody keeps pointing to. He showed code that worked on rows and columns (not lines, sorry) on a table, using prefixes to avoid mixing them.
Haskell types do support this use, but you'll have to declare both types as Integral and Numeric, with the resulting boiterplate. I'm not sure exactly how to solve this, maybe a way to "lift" typeclasses out of a newtype declaration would be general enough. It is probably possible to do with template Haskell, but that is already outside of the language.
That Scala library is interesting, although it looks like lots of the work is done at run time. Also, it looks like Haskell is able to do it [1]. (It's a recurring theme of mine, to complain that something can not be done on Haskell, just to discover somebody that did it.)
[1] http://hackage.haskell.org/package/dimensional http://hackage.haskell.org/package/dimensional