Commit 8ae7c1b5 authored by Ninjatrappeur's avatar Ninjatrappeur Committed by Ben Gamari
Browse files

Make Control.Exception.throw levity polymorphic.

Test Plan: Validate.

Reviewers: hvr, bgamari, sighingnow

Reviewed By: sighingnow

Subscribers: tdammers, sighingnow, rwbarton, thomie, carter

GHC Trac Issues: #15180

Differential Revision: https://phabricator.haskell.org/D4827
parent 4a931665
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
, RecordWildCards , RecordWildCards
, PatternSynonyms , PatternSynonyms
#-} #-}
{-# LANGUAGE TypeInType #-}
{-# OPTIONS_HADDOCK hide #-} {-# OPTIONS_HADDOCK hide #-}
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
...@@ -41,6 +42,7 @@ import GHC.Base ...@@ -41,6 +42,7 @@ import GHC.Base
import GHC.Show import GHC.Show
import GHC.Stack.Types import GHC.Stack.Types
import GHC.OldList import GHC.OldList
import GHC.Prim
import GHC.IO.Unsafe import GHC.IO.Unsafe
import {-# SOURCE #-} GHC.Stack.CCS import {-# SOURCE #-} GHC.Stack.CCS
...@@ -164,7 +166,8 @@ instance Exception SomeException where ...@@ -164,7 +166,8 @@ instance Exception SomeException where
-- | Throw an exception. Exceptions may be thrown from purely -- | Throw an exception. Exceptions may be thrown from purely
-- functional code, but may only be caught within the 'IO' monad. -- functional code, but may only be caught within the 'IO' monad.
throw :: Exception e => e -> a throw :: forall (r :: RuntimeRep). forall (a :: TYPE r). forall e.
Exception e => e -> a
throw e = raise# (toException e) throw e = raise# (toException e)
-- | This is thrown when the user calls 'error'. The first @String@ is the -- | This is thrown when the user calls 'error'. The first @String@ is the
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
* `Data.Monoid.Ap` has been introduced * `Data.Monoid.Ap` has been introduced
* `Control.Exception.throw` is now levity polymorphic. (#15180)
## 4.11.1.0 *TBA* ## 4.11.1.0 *TBA*
* Bundled with GHC 8.4.2 * Bundled with GHC 8.4.2
......
{-# LANGUAGE MagicHash #-}
module Main where
import Control.Exception
import System.Exit
import GHC.Exts
main :: IO ()
main = do
let a = throw $ toException ExitSuccess :: Int#
return ()
...@@ -621,4 +621,5 @@ test('SplitWD', normal, compile, ['']) ...@@ -621,4 +621,5 @@ test('SplitWD', normal, compile, [''])
test('T14441', omit_ways(['profasm']), compile, ['']) test('T14441', omit_ways(['profasm']), compile, [''])
test('T15050', [expect_broken(15050)], compile, ['']) test('T15050', [expect_broken(15050)], compile, [''])
test('T14735', normal, compile, ['']) test('T14735', normal, compile, [''])
test('T15180', normal, compile, [''])
test('T15232', normal, compile, ['']) test('T15232', normal, compile, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment