bjornbm / dimensional-classic

Automatically exported from code.google.com/p/dimensional
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Revert Issue 2 (Dimensionless instance of 'Num' et al) #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Issue 2 was to make 'Dimensionless' an instance of 'Num', 'Fractional' et
al. This was completed in 0.3. However, experience with 0.3 shows that in
practice the grief of 'Dimensionless' being an instance of 'Num' et al
outweighs the gain.

Change back to the previous model with e.g. 'exp', 'cos' et al replacing
(rather than overloading) those in the prelude.

Original issue reported on code.google.com by bjorn.bu...@gmail.com on 8 May 2007 at 12:51

GoogleCodeExporter commented 9 years ago

Original comment by bjorn.bu...@gmail.com on 13 May 2007 at 5:31

GoogleCodeExporter commented 9 years ago
Out of curiosity, what were the issues with instance Num a => Num 
(Dimensionless a) et al?

Original comment by tor...@gmail.com on 17 Sep 2014 at 3:08

GoogleCodeExporter commented 9 years ago
There is a very brief discussion on the wiki: 
https://code.google.com/p/dimensional/wiki/DimensionlessInstanceOfNum

Douglas McClean tried this again more recently and reached the same conclusion: 
that it isn't worth it. I think the killer was type inference not being able to 
pick the appropriate `Num` instance, so that liberal type annotation were 
needed. This more than negated the benefit of being able to use literals.

Note that _1, _2, _3, etc, have been added which in my experience covers most 
of the cases where literals are convenient.

Original comment by bjorn.bu...@gmail.com on 19 Sep 2014 at 8:24