@@ -6,6 +6,9 @@
66{-# LANGUAGE DataKinds #-}
77{-# LANGUAGE PolyKinds #-}
88{-# LANGUAGE GeneralizedNewtypeDeriving #-}
9+{-# LANGUAGE AllowAmbiguousTypes #-}
10+{-# LANGUAGE TypeApplications #-}
11+{-# LANGUAGE ScopedTypeVariables #-}
912{-# LANGUAGE MagicHash #-}
1013
1114-- | See "Control.Monad.Trans.Except".
@@ -25,7 +28,6 @@ module Control.Monad.Trans.Ether.Except
2528 , catch
2629 ) where
2730
28−import GHC.Prim (Proxy#)
2931import Data.Functor.Identity (Identity(..))
3032import qualified Control.Monad.Trans.Except as Trans
3133import Control.Monad.Trans.Ether.Tagged
@@ -40,8 +42,8 @@ import Control.Monad.Trans.Ether.Tagged
4042type Except tag e = ExceptT tag e Identity
4143
4244-- | Runs an 'Except' and returns either an exception or a normal value.
43−runExcept :: Proxy# tag -> Except tag e a -> Either e a
44−runExcept _ = Trans.runExcept . unpack
45+runExcept :: forall tag e a . Except tag e a -> Either e a
46+runExcept = Trans.runExcept . unpack
4547
4648-- | The exception monad transformer.
4749--
@@ -50,22 +52,24 @@ runExcept _ = Trans.runExcept . unpack
5052type ExceptT tag e = TaggedTrans tag (Trans.ExceptT e)
5153
5254-- | Constructor for computations in the exception monad transformer.
53−exceptT :: Proxy# tag -> m (Either e a) -> ExceptT tag e m a
54−exceptT _ = pack . Trans.ExceptT
55+exceptT :: forall tag e m a . m (Either e a) -> ExceptT tag e m a
56+exceptT = pack . Trans.ExceptT
5557
5658-- | Constructor for computations in the exception monad
5759-- (the inverse of 'runExcept').
58−except :: Monad m => Proxy# tag -> Either e a -> ExceptT tag e m a
59−except t = exceptT t . return
60+except :: forall tag e m a . Monad m => Either e a -> ExceptT tag e m a
61+except = exceptT @tag . return
6062
6163-- | 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)
63−runExceptT _ = Trans.runExceptT . unpack
64+runExceptT :: forall tag e m a . ExceptT tag e m a -> m (Either e a)
65+runExceptT = Trans.runExceptT . unpack
6466
6567-- | Is used within a monadic computation to begin exception processing.
66−throw :: Monad m => Proxy# tag -> e -> ExceptT tag e m a
67−throw _ = pack . Trans.throwE
68+throw :: forall tag e m a . Monad m => e -> ExceptT tag e m a
69+throw = pack . Trans.throwE
6870
6971-- | A handler function to handle previous exceptions and return to normal execution.
70−catch :: Monad m => Proxy# tag -> 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)
72+catch
73+ :: forall tag e m a . Monad m
74+ => ExceptT tag e m a -> (e -> ExceptT tag e m a) -> ExceptT tag e m a
75+catch m h = pack $ Trans.catchE (unpack m) (unpack . h)