The unit test on the Typeclasses3 exercise was failing when deriving Read (see issue #38 ).
This is because the derived implementation expects the Constructor to be included in the String.
As far as I know, deriving the Read instance such that it would pass the unit test would require enabling the Language extensions:
{-# LANGUAGE GeneralizedNewtypeDeriving, DerivingStrategies #-}
and then deriving it like so:
deriving newtype Read
This solution seems to be beyond the scope of the exercise.
There might be other ways of solving the exercise that I am not aware of.
Here, I have modified the unit test to make it pass when deriving the Read instance in the usual way.
The unit test on the Typeclasses3 exercise was failing when deriving Read (see issue #38 ). This is because the derived implementation expects the Constructor to be included in the String.
As far as I know, deriving the Read instance such that it would pass the unit test would require enabling the Language extensions:
{-# LANGUAGE GeneralizedNewtypeDeriving, DerivingStrategies #-}
and then deriving it like so:deriving newtype Read
This solution seems to be beyond the scope of the exercise.There might be other ways of solving the exercise that I am not aware of.
Here, I have modified the unit test to make it pass when deriving the Read instance in the usual way.