ghci> let foo = (True, ’a’ && False)
Warning: Couldn’t match ‘Bool’ with ‘Char’
ghci> :type foo
(Bool, Bool)
ghci> fst foo
True
However, with GHC 8.2.2, I get an error when trying to do this:
Prelude> let foo = (True, 'a' && False)
<interactive>:1:18: warning: [-Wdeferred-type-errors]
• Couldn't match expected type ‘Bool’ with actual type ‘Char’
• In the first argument of ‘(&&)’, namely ‘'a'’
In the expression: 'a' && False
In the expression: (True, 'a' && False)
Prelude> :type foo
foo :: (Bool, Bool)
Prelude> fst foo
*** Exception: <interactive>:1:18: error:
• Couldn't match expected type ‘Bool’ with actual type ‘Char’
• In the first argument of ‘(&&)’, namely ‘'a'’
In the expression: 'a' && False
In the expression: (True, 'a' && False)
(deferred type error)
Does anyone know the reason for the change in the behavior? Is there any way to get back to the old behavior, i.e. allow the first element of the tuple to still be extracted? Ideally, I would like to get the errors given by defer-type-errors to be as fine-grained/close-to-the-source as possible.
Thanks,
Bill Hallahan