
#14354: Unexpected type inference behavior with -XTypeApplications -------------------------------------+------------------------------------- Reporter: mbw | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Type checker) | Keywords: | Operating System: POSIX Architecture: x86_64 | Type of failure: None/Unknown (amd64) | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In the following snippet, type inference of the let bound identity function after applying a type unexpectedly fails: {{{#!hs GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help [...] *Main> :set -XTypeApplications *Main> :t id @Int id @Int :: Int -> Int *Main> let the = id *Main> :t the @Int <interactive>:1:1: error: • Cannot apply expression of type ‘a0 -> a0’ to a visible type argument ‘Int’ • In the expression: the @Int *Main> :t _ @Int }}} Note that it works with `id`, but not with `the`. I would expect to be able to write something like `the @Double 42`, for instance. For completeness' sake and since I don't know if it is related or relevant, with GHC 8.0.2, a panic is easily triggered: {{{#!hs Prelude> :set -XTypeApplications Prelude> :t _ @Int ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): initTc: unsolved constraints WC {wc_insol = [W] __a15d :: t_a15c[tau:3] (CHoleCan: _)} Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} This however does not happen with GHC 8.2.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14354 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler