aboutsummaryrefslogtreecommitdiff
path: root/ch07_07.1-ii.hs
blob: 91abc8d0240a44557ec9b4b082b7e7e42c3e54cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- Exercise 7.1-ii
-- What happens to this instance if you remove the `Show t =>` constraint from
-- `HasShow`.

-- Removing `Show t =>` below makes GHC angry:
--
-- • No instance for ‘Show t’ arising from a use of ‘show’
--   Possible fix:
--     add (Show t) to the context of the data constructor ‘HasShow’
data HasShow where
  HasShow :: Show t => t -> HasShow

instance Show HasShow where
  show (HasShow t) = "HasShow " <> show t