MondayMorningHaskell / haskellings

An automated tutorial to teach you about Haskell!
BSD 3-Clause "New" or "Revised" License
166 stars 25 forks source link

Addresses issue #38 Typeclasses3 InterestRate deriving Read issue #39

Closed AR2202 closed 3 years ago

AR2202 commented 3 years ago

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.