From b8479ebcb5873024e7503eb1ea2025858ae44ab3 Mon Sep 17 00:00:00 2001 From: Stephen Diehl Date: Thu, 30 Jun 2016 18:48:55 -0400 Subject: [PATCH] Move throw to Unsafe exports. --- CHANGES.md | 2 ++ src/Protolude.hs | 5 ++++- src/Unsafe.hs | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 856191737..cf65a613c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,8 @@ * Removes ``string-conv`` dependency so Stack build works without ``extra-deps``. * Brings ``Callstack`` machinery in for GHC 8.x. * Removes ``throw`` and ``assert`` from ``Control.Exception`` exports. +* Removes ``unsafeShiftL`` and ``unsafeShiftR`` from ``Data.Bits`` exports. +* Reexport ``throw`` as ``unsafeThrow`` via Unsafe module. 0.1.5 ===== diff --git a/src/Protolude.hs b/src/Protolude.hs index 24fc3645f..9a0b9bb43 100644 --- a/src/Protolude.hs +++ b/src/Protolude.hs @@ -230,7 +230,10 @@ import Control.Monad.Trans as X ( -- Base types import Data.Int as X -import Data.Bits as X +import Data.Bits as X hiding ( + unsafeShiftL + , unsafeShiftR + ) import Data.Word as X import Data.Either as X import Data.Complex as X diff --git a/src/Unsafe.hs b/src/Unsafe.hs index 57c01e47f..ff4d58f34 100644 --- a/src/Unsafe.hs +++ b/src/Unsafe.hs @@ -8,9 +8,11 @@ module Unsafe ( unsafeLast, unsafeFromJust, unsafeIndex, + unsafeThrow, ) where import Base (Int) +import Control.Exception as Exc import qualified Data.List as List import qualified Data.Maybe as Maybe @@ -31,3 +33,6 @@ unsafeFromJust = Maybe.fromJust unsafeIndex :: [a] -> Int -> a unsafeIndex = (List.!!) + +unsafeThrow :: Exc.Exception e => e -> a +unsafeThrow = Exc.throw