Allow ($) to return an unlifted type (Trac #8739)
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 18 Feb 2014 08:46:14 +0000 (08:46 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 18 Feb 2014 08:46:28 +0000 (08:46 +0000)
commit5dd1cbbfc0a19e92d7eeff6f328abc7558992fd6
treedf52ce0f531c0fd5764faaf5e0b35a5c97a8db96
parent47f473b0f7ddf21b2cde825166d092cb6e72329d
Allow ($) to return an unlifted type (Trac #8739)

Since ($) simply returns its result, via a tail call, it can
perfectly well have an unlifted result type; e.g.
    foo $ True    where  foo :: Bool -> Int#
should be perfectly fine.

This used to work in GHC 7.2, but caused a Lint failure.  This patch
makes it work again (which involved removing code in TcExpr), but fixing
the Lint failure meant I had to make ($) into a wired-in Id.  Which
is not hard to do (in MkId).
compiler/basicTypes/MkId.lhs
compiler/prelude/PrelNames.lhs
compiler/typecheck/TcExpr.lhs
testsuite/tests/typecheck/should_compile/T8739.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T7857.stderr
testsuite/tests/typecheck/should_run/T8739.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_run/T8739.stdout [new file with mode: 0644]
testsuite/tests/typecheck/should_run/all.T