@@ -6,6 +6,9 @@
6{-# LANGUAGE DataKinds #-}
6{-# LANGUAGE DataKinds #-}
7{-# LANGUAGE PolyKinds #-}
7{-# LANGUAGE PolyKinds #-}
8{-# LANGUAGE GeneralizedNewtypeDeriving #-}
8{-# LANGUAGE GeneralizedNewtypeDeriving #-}
9+{-# LANGUAGE AllowAmbiguousTypes #-}
10+{-# LANGUAGE TypeApplications #-}
11+{-# LANGUAGE ScopedTypeVariables #-}
9{-# LANGUAGE MagicHash #-}
12{-# LANGUAGE MagicHash #-}
11-- | See "Control.Monad.Trans.Except".
14-- | See "Control.Monad.Trans.Except".
@@ -25,7 +28,6 @@ module Control.Monad.Trans.Ether.Except
28−import GHC.Prim (Proxy#)
29import Data.Functor.Identity (Identity(..))
31import Data.Functor.Identity (Identity(..))
30import qualified Control.Monad.Trans.Except as Trans
32import qualified Control.Monad.Trans.Except as Trans
31import Control.Monad.Trans.Ether.Tagged
33import Control.Monad.Trans.Ether.Tagged
@@ -40,8 +42,8 @@ import Control.Monad.Trans.Ether.Tagged
40type Except tag e = ExceptT tag e Identity
42type Except tag e = ExceptT tag e Identity
42-- | Runs an 'Except' and returns either an exception or a normal value.
44-- | Runs an 'Except' and returns either an exception or a normal value.
43−runExcept :: Proxy# tag -> Except tag e a -> Either e a
45+runExcept :: forall tag e a . Except tag e a -> Either e a
44−runExcept _ = Trans.runExcept . unpack
46+runExcept = Trans.runExcept . unpack
46-- | The exception monad transformer.
48-- | The exception monad transformer.
@@ -50,22 +52,24 @@ runExcept _ = Trans.runExcept . unpack
50type ExceptT tag e = TaggedTrans tag (Trans.ExceptT e)
52type ExceptT tag e = TaggedTrans tag (Trans.ExceptT e)
52-- | Constructor for computations in the exception monad transformer.
54-- | Constructor for computations in the exception monad transformer.
53−exceptT :: Proxy# tag -> m (Either e a) -> ExceptT tag e m a
55+exceptT :: forall tag e m a . m (Either e a) -> ExceptT tag e m a
54−exceptT _ = pack . Trans.ExceptT
56+exceptT = pack . Trans.ExceptT
56-- | Constructor for computations in the exception monad
58-- | Constructor for computations in the exception monad
57-- (the inverse of 'runExcept').
59-- (the inverse of 'runExcept').
58−except :: Monad m => Proxy# tag -> Either e a -> ExceptT tag e m a
60+except :: forall tag e m a . Monad m => Either e a -> ExceptT tag e m a
59−except t = exceptT t . return
61+except = exceptT @tag . return
61-- | Runs an 'ExceptT' and returns either an exception or a normal value.
63-- | Runs an 'ExceptT' and returns either an exception or a normal value.
62−runExceptT :: Proxy# tag -> ExceptT tag e m a -> m (Either e a)
64+runExceptT :: forall tag e m a . ExceptT tag e m a -> m (Either e a)
63−runExceptT _ = Trans.runExceptT . unpack
65+runExceptT = Trans.runExceptT . unpack
65-- | Is used within a monadic computation to begin exception processing.
67-- | Is used within a monadic computation to begin exception processing.
66−throw :: Monad m => Proxy# tag -> e -> ExceptT tag e m a
68+throw :: forall tag e m a . Monad m => e -> ExceptT tag e m a
67−throw _ = pack . Trans.throwE
69+throw = pack . Trans.throwE
69-- | A handler function to handle previous exceptions and return to normal execution.
71-- | A handler function to handle previous exceptions and return to normal execution.
73+ :: forall tag e m a . Monad m
70−catch :: Monad m => Proxy# tag -> ExceptT tag e m a -> (e -> ExceptT tag e m a) -> ExceptT tag e m a
74+ => ExceptT tag e m a -> (e -> ExceptT tag e m a) -> ExceptT tag e m a
71−catch _ m h = pack $ Trans.catchE (unpack m) (unpack . h)
75+catch m h = pack $ Trans.catchE (unpack m) (unpack . h)