Am Dienstag, den 25.09.2018, 02:05 +0530 schrieb Harendra Kumar:
That's where I started. I already use a newtype with GND for this, and it looks like this:

newtype Count = Count Int64
    deriving ( Eq
             , Read
             , Show
             , Enum
             , Bounded
             , Num
             , Real
             , Integral
             , Ord
             )

The problem is that most programmers are lazy or hard pressed for time and having to write a newtype with a big list of instances actually discourages the use of newtypes freely for this case, they may just make it a habit to let it go. We can't just deny this and say that programmers must be disciplined. They will often try taking the path of least effort.

I think that the time it takes to come up with and write down such explicit lists is usually small compared to the time it takes to do all the other development. And once you have made the instantiation lists explicit, you will probably save time in the future, because bugs will detected automatically more often. The latter point is something that is often overlooked: people are under time pressure and strive for quick solutions but spend more time in the long run this way.

All the best,
Wolfgang