simplybusiness / haskell-club

Learning a Haskell for great glory (public repo)
MIT License
1 stars 0 forks source link

Can we make it so Postcode doesn't have to be Ord? #7

Open daniel-barlow opened 7 years ago

daniel-barlow commented 7 years ago

Try deleting the line beginning instance Ord Postcode and you will see it blow up. I believe this is because:

applyRate :: Ord t => RateTable t -> t -> Money -> Money

GHC infers that the type of applyRate's second param must be Ord, because the function's implementation in Bands compares it using >. Even though that code path isn't taken for Postcode comparison.

Is there a better way?