
Hi, I'm trying to use the -fdefer-type-error flag, discussed in an ICFP paper from 2012: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.366.841&rep=rep1&type=pdf http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.366.841&rep=rep1&type=pdf On page 2, the paper has an example, showing that fdefer-type-errors will allow a the first element to be extracted fro a tuple, even if the second element does not correctly typecheck: 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: GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help 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

On Wed, Apr 17, 2019 at 04:17:17PM -0400, Bill Hallahan wrote:
However, with GHC 8.2.2, I get an error when trying to do this: [...] Prelude> let foo = (True, 'a' && False) [...] Prelude> fst foo *** Exception: <interactive>:1:18: error: • Couldn't match expected type ‘Bool’ with actual type ‘Char’
FWIW I see this behaviour in GHC 8.0.1 too.

I checked the release prior to 8.0.1 — 7.10.3, and it worked as expected (returned `True`). This looks like a bug introduced somewhere in between. I wish I could do git bisect on GHC properly… Worth reporting, I guess. -- Best, Artem On Wed, 17 Apr 2019 at 16:26, Tom Ellis < tom-lists-haskell-cafe-2017@jaguarpaw.co.uk> wrote:
On Wed, Apr 17, 2019 at 04:17:17PM -0400, Bill Hallahan wrote:
However, with GHC 8.2.2, I get an error when trying to do this: [...] Prelude> let foo = (True, 'a' && False) [...] Prelude> fst foo *** Exception: <interactive>:1:18: error: • Couldn't match expected type ‘Bool’ with actual type ‘Char’
FWIW I see this behaviour in GHC 8.0.1 too. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

I believe this is a known bug: #11197 (https://gitlab.haskell.org/ghc/ghc/issues/11197 https://gitlab.haskell.org/ghc/ghc/issues/11197) If you reported this again, could you please update your post to point to #11197? Thanks for reporting, regardless! Richard
On Apr 17, 2019, at 6:20 PM, Artem Pelenitsyn
wrote: I checked the release prior to 8.0.1 — 7.10.3, and it worked as expected (returned `True`). This looks like a bug introduced somewhere in between. I wish I could do git bisect on GHC properly…
Worth reporting, I guess.
-- Best, Artem
On Wed, 17 Apr 2019 at 16:26, Tom Ellis
mailto:tom-lists-haskell-cafe-2017@jaguarpaw.co.uk> wrote: On Wed, Apr 17, 2019 at 04:17:17PM -0400, Bill Hallahan wrote: However, with GHC 8.2.2, I get an error when trying to do this: [...] Prelude> let foo = (True, 'a' && False) [...] Prelude> fst foo *** Exception: <interactive>:1:18: error: • Couldn't match expected type ‘Bool’ with actual type ‘Char’
FWIW I see this behaviour in GHC 8.0.1 too. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

Thanks for the pointer! I hadn't gotten to reporting it yet, so nothing to update. Bill
On Apr 17, 2019, at 11:03 PM, Richard Eisenberg
wrote: I believe this is a known bug: #11197 (https://gitlab.haskell.org/ghc/ghc/issues/11197 https://gitlab.haskell.org/ghc/ghc/issues/11197)
If you reported this again, could you please update your post to point to #11197? Thanks for reporting, regardless!
Richard
On Apr 17, 2019, at 6:20 PM, Artem Pelenitsyn
mailto:a.pelenitsyn@gmail.com> wrote: I checked the release prior to 8.0.1 — 7.10.3, and it worked as expected (returned `True`). This looks like a bug introduced somewhere in between. I wish I could do git bisect on GHC properly…
Worth reporting, I guess.
-- Best, Artem
On Wed, 17 Apr 2019 at 16:26, Tom Ellis
mailto:tom-lists-haskell-cafe-2017@jaguarpaw.co.uk> wrote: On Wed, Apr 17, 2019 at 04:17:17PM -0400, Bill Hallahan wrote: However, with GHC 8.2.2, I get an error when trying to do this: [...] Prelude> let foo = (True, 'a' && False) [...] Prelude> fst foo *** Exception: <interactive>:1:18: error: • Couldn't match expected type ‘Bool’ with actual type ‘Char’
FWIW I see this behaviour in GHC 8.0.1 too. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
participants (4)
-
Artem Pelenitsyn
-
Bill Hallahan
-
Richard Eisenberg
-
Tom Ellis