@@ -7,6 +7,7 @@
77{-# LANGUAGE DataKinds #-}
88{-# LANGUAGE PolyKinds #-}
99{-# LANGUAGE GeneralizedNewtypeDeriving #-}
10+{-# LANGUAGE MagicHash #-}
1011
1112-- | See "Control.Monad.Trans.Writer".
1213
@@ -32,6 +33,7 @@ module Control.Monad.Trans.Ether.Writer
3233import Data.Monoid
3334#endif
3435
36+import GHC.Prim (Proxy#)
3537import Data.Functor.Identity (Identity(..))
3638import qualified Control.Monad.Trans.Writer.Lazy as Trans
3739import Control.Monad.Trans.Ether.Tagged
@@ -51,36 +53,36 @@ type Writer tag w = WriterT tag w Identity
5153type WriterT tag w = TaggedTrans tag (Trans.WriterT w)
5254
5355-- | Constructor for computations in the writer monad transformer.
54−writerT :: proxy tag -> m (a, w) -> WriterT tag w m a
56+writerT :: Proxy# tag -> m (a, w) -> WriterT tag w m a
5557writerT _ = pack . Trans.WriterT
5658
5759-- | Constructor for computations in the writer monad
5860-- (the inverse of 'runWriter').
59−writer :: Monad m => proxy tag -> (a, w) -> WriterT tag w m a
61+writer :: Monad m => Proxy# tag -> (a, w) -> WriterT tag w m a
6062writer _ = pack . Trans.writer
6163
6264-- | Runs a 'WriterT' and returns both the normal value
6365-- and the final accumulator.
64−runWriterT :: proxy tag -> WriterT tag w m a -> m (a, w)
66+runWriterT :: Proxy# tag -> WriterT tag w m a -> m (a, w)
6567runWriterT _ = Trans.runWriterT . unpack
6668
6769-- | Runs a 'Writer' and returns both the normal value
6870-- and the final accumulator.
69−runWriter :: proxy tag -> Writer tag w a -> (a, w)
71+runWriter :: Proxy# tag -> Writer tag w a -> (a, w)
7072runWriter _ = Trans.runWriter . unpack
7173
7274-- | Runs a 'WriterT' and returns the final accumulator,
7375-- discarding the normal value.
74−execWriterT :: Monad m => proxy tag -> WriterT tag w m a -> m w
76+execWriterT :: Monad m => Proxy# tag -> WriterT tag w m a -> m w
7577execWriterT _ = Trans.execWriterT . unpack
7678
7779-- | Runs a 'Writer' and returns the final accumulator,
7880-- discarding the normal value.
79−execWriter :: proxy tag -> Writer tag w a -> w
81+execWriter :: Proxy# tag -> Writer tag w a -> w
8082execWriter _ = Trans.execWriter . unpack
8183
8284-- | Appends a value to the accumulator within the monad.
83−tell :: Monad m => proxy tag -> w -> WriterT tag w m ()
85+tell :: Monad m => Proxy# tag -> w -> WriterT tag w m ()
8486tell t w = writer t ((), w)
8587
8688-- | Executes an action and adds its accumulator to the value of the computation.
@@ -90,7 +92,7 @@ listen
9092#else
9193 :: Monad m
9294#endif
93− => proxy tag -> WriterT tag w m a -> WriterT tag w m (a, w)
95+ => Proxy# tag -> WriterT tag w m a -> WriterT tag w m (a, w)
9496listen _ = pack . Trans.listen . unpack
9597
9698-- | Executes an action which returns a value and a function, and returns the
@@ -101,5 +103,5 @@ pass
101103#else
102104 :: Monad m
103105#endif
104− => proxy tag -> WriterT tag w m (a, w -> w) -> WriterT tag w m a
106+ => Proxy# tag -> WriterT tag w m (a, w -> w) -> WriterT tag w m a
105107pass _ = pack . Trans.pass . unpack