on master help sign in
Ambiguous wrappers instead of TH (#21)
8d8e5ffIndex Int
ether.cabal+8−1
@@ -28,7 +28,6 @@ library
28
28
29 exposed-modules: Control.Ether.Abbr
29 exposed-modules: Control.Ether.Abbr
30 Control.Ether.Implicit.Abbr
30 Control.Ether.Implicit.Abbr
31− Control.Ether.TH
32 Control.Monad.Trans.Ether.Reader
31 Control.Monad.Trans.Ether.Reader
33 Control.Monad.Trans.Ether.Writer
32 Control.Monad.Trans.Ether.Writer
34 Control.Monad.Trans.Ether.State
33 Control.Monad.Trans.Ether.State
@@ -55,6 +54,13 @@ library
55 Control.Monad.Ether.Implicit.State.Lazy
54 Control.Monad.Ether.Implicit.State.Lazy
56 Control.Monad.Ether.Implicit.State.Strict
55 Control.Monad.Ether.Implicit.State.Strict
57 Control.Monad.Ether.Implicit.Except
56 Control.Monad.Ether.Implicit.Except
57+ Control.Monad.Ether.Ambiguous
58+ Control.Monad.Ether.Ambiguous.Reader
59+ Control.Monad.Ether.Ambiguous.Writer
60+ Control.Monad.Ether.Ambiguous.State
61+ Control.Monad.Ether.Ambiguous.State.Lazy
62+ Control.Monad.Ether.Ambiguous.State.Strict
63+ Control.Monad.Ether.Ambiguous.Except
58
64
59 build-depends: base >=4.7 && <4.10
65 build-depends: base >=4.7 && <4.10
60 , transformers >=0.4.2
66 , transformers >=0.4.2
@@ -122,6 +128,7 @@ test-suite regression
122 PolyKinds
128 PolyKinds
123 ScopedTypeVariables
129 ScopedTypeVariables
124 TemplateHaskell
130 TemplateHaskell
131+ TypeApplications
125 TypeFamilies
132 TypeFamilies
126 TypeOperators
133 TypeOperators
127 QuasiQuotes
134 QuasiQuotes
src/Control/Ether/TH.hsdeleted−19
@@ -1,19 +0,0 @@
1−{-# LANGUAGE TemplateHaskell #-}
2−{-# LANGUAGE MagicHash #-}
3−
4−-- | Template Haskell utilities.
5−
6−module Control.Ether.TH (tag) where
7−
8−import qualified Language.Haskell.TH as TH
9−import qualified Language.Haskell.TH.Quote as TH
10−
11−import GHC.Prim (Proxy#, proxy#)
12−
13−tag :: TH.QuasiQuoter
14−tag = TH.QuasiQuoter proxyExpQ undefined undefined undefined
15− where
16− proxyExpQ :: String -> TH.ExpQ
17− proxyExpQ nameStr =
18− let ty = TH.conT (TH.mkName nameStr)
19− in [e| proxy# :: Proxy# $ty |]
src/Control/Monad/Ether.hs−1
@@ -11,4 +11,3 @@ import Control.Monad.Ether.Writer as X
11import Control.Monad.Ether.State as X
11import Control.Monad.Ether.State as X
12import Control.Monad.Ether.Except as X
12import Control.Monad.Ether.Except as X
13import Control.Monad.Trans.Ether.Dispatch as X
13import Control.Monad.Trans.Ether.Dispatch as X
14−import Control.Ether.TH as X (tag)
src/Control/Monad/Ether/Ambiguous.hsnew file+13
@@ -0,0 +1,13 @@
1+
2+-- | This module provides convenience exports of all
3+-- ambiguously tagged monad classes from Ether.
4+
5+module Control.Monad.Ether.Ambiguous (module X) where
6+
7+import Control.Monad as X
8+import Control.Monad.Fix as X
9+import Control.Monad.Ether.Ambiguous.Reader as X
10+import Control.Monad.Ether.Ambiguous.Writer as X
11+import Control.Monad.Ether.Ambiguous.State as X
12+import Control.Monad.Ether.Ambiguous.Except as X
13+import Control.Monad.Trans.Ether.Dispatch as X
src/Control/Monad/Ether/Ambiguous/Except.hsnew file+55
@@ -0,0 +1,55 @@
1+{-# LANGUAGE AllowAmbiguousTypes #-}
2+{-# LANGUAGE ScopedTypeVariables #-}
3+{-# LANGUAGE MagicHash #-}
4+
5+-- | See "Control.Monad.Ether.Except".
6+
7+module Control.Monad.Ether.Ambiguous.Except
8+ (
9+ -- * MonadExcept class
10+ MonadExcept
11+ , throw
12+ , catch
13+ -- * The Except monad
14+ , Except
15+ , runExcept
16+ -- * The ExceptT monad transformer
17+ , ExceptT
18+ , exceptT
19+ , runExceptT
20+ -- * Handle functions
21+ , handle
22+ , handleT
23+ ) where
24+
25+import GHC.Prim (Proxy#, proxy#)
26+import Control.Monad.Ether.Except (MonadExcept, ExceptT, Except)
27+import qualified Control.Monad.Ether.Except as Explicit
28+
29+-- | See 'Control.Monad.Ether.Except.throw'.
30+throw :: forall tag e m a . MonadExcept tag e m => e -> m a
31+throw = Explicit.throw (proxy# :: Proxy# tag)
32+
33+-- | See 'Control.Monad.Ether.Except.catch'.
34+catch :: forall tag e m a . MonadExcept tag e m => m a -> (e -> m a) -> m a
35+catch = Explicit.catch (proxy# :: Proxy# tag)
36+
37+-- | See 'Control.Monad.Ether.Except.runExcept'.
38+runExcept :: forall tag e a . Except tag e a -> Either e a
39+runExcept = Explicit.runExcept proxy#
40+
41+-- | See 'Control.Monad.Ether.Except.exceptT'.
42+exceptT :: forall tag e m a . m (Either e a) -> ExceptT tag e m a
43+exceptT = Explicit.exceptT proxy#
44+
45+-- | See 'Control.Monad.Ether.Except.runExceptT'.
46+runExceptT :: forall tag e m a . ExceptT tag e m a -> m (Either e a)
47+runExceptT = Explicit.runExceptT proxy#
48+
49+-- | See 'Control.Monad.Ether.Except.handle'.
50+handle :: forall tag e a . (e -> a) -> Except tag e a -> a
51+handle = Explicit.handle proxy#
52+
53+-- | See 'Control.Monad.Ether.Except.handleT'.
54+handleT :: forall tag e m a . Functor m => (e -> a) -> ExceptT tag e m a -> m a
55+handleT = Explicit.handleT proxy#
src/Control/Monad/Ether/Ambiguous/Reader.hsnew file+54
@@ -0,0 +1,54 @@
1+{-# LANGUAGE AllowAmbiguousTypes #-}
2+{-# LANGUAGE ScopedTypeVariables #-}
3+{-# LANGUAGE MagicHash #-}
4+
5+-- | See "Control.Monad.Ether.Reader".
6+
7+module Control.Monad.Ether.Ambiguous.Reader
8+ (
9+ -- * MonadReader class
10+ MonadReader
11+ , local
12+ , ask
13+ , reader
14+ , asks
15+ -- * The Reader monad
16+ , Reader
17+ , runReader
18+ -- * The ReaderT monad transformer
19+ , ReaderT
20+ , readerT
21+ , runReaderT
22+ ) where
23+
24+import GHC.Prim (Proxy#, proxy#)
25+import Control.Monad.Ether.Reader (MonadReader, ReaderT, Reader)
26+import qualified Control.Monad.Ether.Reader as Explicit
27+
28+-- | See 'Control.Monad.Ether.Reader.readerT'.
29+readerT :: forall tag r m a . (r -> m a) -> ReaderT tag r m a
30+readerT = Explicit.readerT proxy#
31+
32+-- | See 'Control.Monad.Ether.Reader.runReaderT'.
33+runReaderT :: forall tag r m a . ReaderT tag r m a -> r -> m a
34+runReaderT = Explicit.runReaderT proxy#
35+
36+-- | See 'Control.Monad.Ether.Reader.runReader'.
37+runReader :: forall tag r a . Reader tag r a -> r -> a
38+runReader = Explicit.runReader proxy#
39+
40+-- | See 'Control.Monad.Ether.Reader.local'.
41+local :: forall tag r m a . MonadReader tag r m => (r -> r) -> m a -> m a
42+local = Explicit.local (proxy# :: Proxy# tag)
43+
44+-- | See 'Control.Monad.Ether.Reader.ask'.
45+ask :: forall tag r m . MonadReader tag r m => m r
46+ask = Explicit.ask (proxy# :: Proxy# tag)
47+
48+-- | See 'Control.Monad.Ether.Reader.reader'.
49+reader :: forall tag r m a . MonadReader tag r m => (r -> a) -> m a
50+reader = Explicit.reader (proxy# :: Proxy# tag)
51+
52+-- | See 'Control.Monad.Ether.Reader.asks'.
53+asks :: forall tag r m a . MonadReader tag r m => (r -> a) -> m a
54+asks = Explicit.asks (proxy# :: Proxy# tag)
src/Control/Monad/Ether/Ambiguous/State.hsnew file+8
@@ -0,0 +1,8 @@
1+
2+-- | See "Control.Monad.Ether.State".
3+
4+module Control.Monad.Ether.Ambiguous.State
5+ ( module Control.Monad.Ether.Ambiguous.State.Lazy
6+ ) where
7+
8+import Control.Monad.Ether.Ambiguous.State.Lazy
src/Control/Monad/Ether/Ambiguous/State/Lazy.hsnew file+79
@@ -0,0 +1,79 @@
1+{-# LANGUAGE AllowAmbiguousTypes #-}
2+{-# LANGUAGE ScopedTypeVariables #-}
3+{-# LANGUAGE MagicHash #-}
4+
5+-- | See "Control.Monad.Ether.State.Lazy".
6+
7+module Control.Monad.Ether.Ambiguous.State.Lazy
8+ (
9+ -- * MonadState class
10+ MonadState
11+ , get
12+ , put
13+ , state
14+ , modify
15+ , gets
16+ -- * The State monad
17+ , State
18+ , runState
19+ , evalState
20+ , execState
21+ -- * The StateT monad transformer
22+ , StateT
23+ , stateT
24+ , runStateT
25+ , evalStateT
26+ , execStateT
27+ ) where
28+
29+import GHC.Prim (Proxy#, proxy#)
30+import Control.Monad.Ether.State.Lazy (MonadState, StateT, State)
31+import qualified Control.Monad.Ether.State.Lazy as Explicit
32+
33+-- | See 'Control.Monad.Ether.State.Lazy.stateT'.
34+stateT :: forall tag s m a . (s -> m (a, s)) -> StateT tag s m a
35+stateT = Explicit.stateT proxy#
36+
37+-- | See 'Control.Monad.Ether.State.Lazy.runStateT'.
38+runStateT :: forall tag s m a . StateT tag s m a -> s -> m (a, s)
39+runStateT = Explicit.runStateT proxy#
40+
41+-- | See 'Control.Monad.Ether.State.Lazy.runState'.
42+runState :: forall tag s a . State tag s a -> s -> (a, s)
43+runState = Explicit.runState proxy#
44+
45+-- | See 'Control.Monad.Ether.State.Lazy.evalStateT'.
46+evalStateT :: forall tag s m a . Monad m => StateT tag s m a -> s -> m a
47+evalStateT = Explicit.evalStateT proxy#
48+
49+-- | See 'Control.Monad.Ether.State.Lazy.evalState'.
50+evalState :: forall tag s a . State tag s a -> s -> a
51+evalState = Explicit.evalState proxy#
52+
53+-- | See 'Control.Monad.Ether.State.Lazy.execStateT'.
54+execStateT :: forall tag s m a . Monad m => StateT tag s m a -> s -> m s
55+execStateT = Explicit.execStateT proxy#
56+
57+-- | See 'Control.Monad.Ether.State.Lazy.execState'.
58+execState :: forall tag s a . State tag s a -> s -> s
59+execState = Explicit.execState proxy#
60+
61+-- | See 'Control.Monad.Ether.State.Lazy.get'.
62+get :: forall tag s m . MonadState tag s m => m s
63+get = Explicit.get (proxy# :: Proxy# tag)
64+
65+-- | See 'Control.Monad.Ether.State.Lazy.gets'.
66+gets :: forall tag s m a . MonadState tag s m => (s -> a) -> m a
67+gets = Explicit.gets (proxy# :: Proxy# tag)
68+
69+-- | See 'Control.Monad.Ether.State.Lazy.put'.
70+put :: forall tag s m . MonadState tag s m => s -> m ()
71+put = Explicit.put (proxy# :: Proxy# tag)
72+
73+-- | See 'Control.Monad.Ether.State.Lazy.state'.
74+state :: forall tag s m a . MonadState tag s m => (s -> (a, s)) -> m a
75+state = Explicit.state (proxy# :: Proxy# tag)
76+
77+-- | See 'Control.Monad.Ether.State.Lazy.modify'.
78+modify :: forall tag s m . MonadState tag s m => (s -> s) -> m ()
79+modify = Explicit.modify (proxy# :: Proxy# tag)
src/Control/Monad/Ether/Ambiguous/State/Strict.hsnew file+79
@@ -0,0 +1,79 @@
1+{-# LANGUAGE AllowAmbiguousTypes #-}
2+{-# LANGUAGE ScopedTypeVariables #-}
3+{-# LANGUAGE MagicHash #-}
4+
5+-- | See "Control.Monad.Ether.State.Strict".
6+
7+module Control.Monad.Ether.Ambiguous.State.Strict
8+ (
9+ -- * MonadState class
10+ MonadState
11+ , get
12+ , put
13+ , state
14+ , modify
15+ , gets
16+ -- * The State monad
17+ , State
18+ , runState
19+ , evalState
20+ , execState
21+ -- * The StateT monad transformer
22+ , StateT
23+ , stateT
24+ , runStateT
25+ , evalStateT
26+ , execStateT
27+ ) where
28+
29+import GHC.Prim (Proxy#, proxy#)
30+import Control.Monad.Ether.State.Strict (MonadState, StateT, State)
31+import qualified Control.Monad.Ether.State.Strict as Explicit
32+
33+-- | See 'Control.Monad.Ether.State.Strict.stateT'.
34+stateT :: forall tag s m a . (s -> m (a, s)) -> StateT tag s m a
35+stateT = Explicit.stateT proxy#
36+
37+-- | See 'Control.Monad.Ether.State.Strict.runStateT'.
38+runStateT :: forall tag s m a . StateT tag s m a -> s -> m (a, s)
39+runStateT = Explicit.runStateT proxy#
40+
41+-- | See 'Control.Monad.Ether.State.Strict.runState'.
42+runState :: forall tag s a . State tag s a -> s -> (a, s)
43+runState = Explicit.runState proxy#
44+
45+-- | See 'Control.Monad.Ether.State.Strict.evalStateT'.
46+evalStateT :: forall tag s m a . Monad m => StateT tag s m a -> s -> m a
47+evalStateT = Explicit.evalStateT proxy#
48+
49+-- | See 'Control.Monad.Ether.State.Strict.evalState'.
50+evalState :: forall tag s a . State tag s a -> s -> a
51+evalState = Explicit.evalState proxy#
52+
53+-- | See 'Control.Monad.Ether.State.Strict.execStateT'.
54+execStateT :: forall tag s m a . Monad m => StateT tag s m a -> s -> m s
55+execStateT = Explicit.execStateT proxy#
56+
57+-- | See 'Control.Monad.Ether.State.Strict.execState'.
58+execState :: forall tag s a . State tag s a -> s -> s
59+execState = Explicit.execState proxy#
60+
61+-- | See 'Control.Monad.Ether.State.Strict.get'.
62+get :: forall tag s m . MonadState tag s m => m s
63+get = Explicit.get (proxy# :: Proxy# tag)
64+
65+-- | See 'Control.Monad.Ether.State.Strict.gets'.
66+gets :: forall tag s m a . MonadState tag s m => (s -> a) -> m a
67+gets = Explicit.gets (proxy# :: Proxy# tag)
68+
69+-- | See 'Control.Monad.Ether.State.Strict.put'.
70+put :: forall tag s m . MonadState tag s m => s -> m ()
71+put = Explicit.put (proxy# :: Proxy# tag)
72+
73+-- | See 'Control.Monad.Ether.State.Strict.state'.
74+state :: forall tag s m a . MonadState tag s m => (s -> (a, s)) -> m a
75+state = Explicit.state (proxy# :: Proxy# tag)
76+
77+-- | See 'Control.Monad.Ether.State.Strict.modify'.
78+modify :: forall tag s m . MonadState tag s m => (s -> s) -> m ()
79+modify = Explicit.modify (proxy# :: Proxy# tag)
src/Control/Monad/Ether/Ambiguous/Writer.hsnew file+74
@@ -0,0 +1,74 @@
1+{-# LANGUAGE AllowAmbiguousTypes #-}
2+{-# LANGUAGE ScopedTypeVariables #-}
3+{-# LANGUAGE MagicHash #-}
4+
5+-- | See "Control.Monad.Ether.Writer".
6+
7+module Control.Monad.Ether.Ambiguous.Writer
8+ (
9+ -- * MonadWriter class
10+ MonadWriter
11+ , writer
12+ , tell
13+ , listen
14+ , pass
15+ , listens
16+ , censor
17+ -- * The Writer monad
18+ , Writer
19+ , runWriter
20+ , execWriter
21+ -- * The WriterT monad transformer
22+ , WriterT
23+ , writerT
24+ , runWriterT
25+ , execWriterT
26+ ) where
27+
28+import GHC.Prim (Proxy#, proxy#)
29+import Control.Monad.Ether.Writer (MonadWriter, WriterT, Writer)
30+import qualified Control.Monad.Ether.Writer as Explicit
31+
32+-- | See 'Control.Monad.Ether.Writer.writer'.
33+writer :: forall tag w m a . MonadWriter tag w m => (a, w) -> m a
34+writer = Explicit.writer (proxy# :: Proxy# tag)
35+
36+-- | See 'Control.Monad.Ether.Writer.tell'.
37+tell :: forall tag w m . MonadWriter tag w m => w -> m ()
38+tell = Explicit.tell (proxy# :: Proxy# tag)
39+
40+-- | See 'Control.Monad.Ether.Writer.listen'.
41+listen :: forall tag w m a . MonadWriter tag w m => m a -> m (a, w)
42+listen = Explicit.listen (proxy# :: Proxy# tag)
43+
44+-- | See 'Control.Monad.Ether.Writer.pass'.
45+pass :: forall tag w m a . MonadWriter tag w m => m (a, w -> w) -> m a
46+pass = Explicit.pass (proxy# :: Proxy# tag)
47+
48+-- | See 'Control.Monad.Ether.Writer.listens'.
49+listens :: forall tag w m a b . MonadWriter tag w m => (w -> b) -> m a -> m (a, b)
50+listens = Explicit.listens (proxy# :: Proxy# tag)
51+
52+-- | See 'Control.Monad.Ether.Writer.censor'.
53+censor :: forall tag w m a . MonadWriter tag w m => (w -> w) -> m a -> m a
54+censor = Explicit.censor (proxy# :: Proxy# tag)
55+
56+-- | See 'Control.Monad.Ether.Writer.runWriter'.
57+runWriter :: forall tag w a . Writer tag w a -> (a, w)
58+runWriter = Explicit.runWriter proxy#
59+
60+-- | See 'Control.Monad.Ether.Writer.execWriter'.
61+execWriter :: forall tag w a . Writer tag w a -> w
62+execWriter = Explicit.execWriter proxy#
63+
64+-- | See 'Control.Monad.Ether.Writer.writerT'.
65+writerT :: forall tag w m a . m (a, w) -> WriterT tag w m a
66+writerT = Explicit.writerT proxy#
67+
68+-- | See 'Control.Monad.Ether.Writer.runWriterT'.
69+runWriterT :: forall tag w m a . WriterT tag w m a -> m (a, w)
70+runWriterT = Explicit.runWriterT proxy#
71+
72+-- | See 'Control.Monad.Ether.Writer.execWriterT'.
73+execWriterT :: forall tag w m a . Monad m => WriterT tag w m a -> m w
74+execWriterT = Explicit.execWriterT proxy#
src/Control/Monad/Trans/Ether/Dispatch.hs+4−8
@@ -144,16 +144,12 @@ instance Lift.LiftCallCC (DispatchT dp) where
144 liftCallCC' = Lift.defaultLiftCallCC' pack unpack
144 liftCallCC' = Lift.defaultLiftCallCC' pack unpack
145
145
146-- | Attach a tag to untagged transformers.
146-- | Attach a tag to untagged transformers.
147−tagAttach :: Proxy# t -> DispatchTagAttachT t m a -> m a
147+tagAttach :: forall tag m a . DispatchTagAttachT tag m a -> m a
148−tagAttach _ = coerce
148+tagAttach = coerce
149
149
150-- | Replace a tag with another tag.
150-- | Replace a tag with another tag.
151−tagReplace
152− :: Proxy# tOld
153− -> Proxy# tNew
154− -> DispatchTagReplaceT tOld tNew m a
151+tagReplace :: forall tOld tNew m a . DispatchTagReplaceT tOld tNew m a -> m a
155− -> m a
156−tagReplace _ _ = coerce
152+tagReplace = coerce
157
153
158
154
159-- TagAttach instances
155-- TagAttach instances
test/Regression/T1.hs+8−8
@@ -1,6 +1,6 @@
1module Regression.T1 (test1) where
1module Regression.T1 (test1) where
2
2
3−import Control.Monad.Ether
3+import Control.Monad.Ether.Ambiguous
4import Control.Ether.Abbr
4import Control.Ether.Abbr
5
5
6import Test.Tasty
6import Test.Tasty
@@ -13,17 +13,17 @@ testEther
13 :: Ether '[Tag1 --> String, Tag2 --> String] m
13 :: Ether '[Tag1 --> String, Tag2 --> String] m
14 => m ((String, String), (String, String))
14 => m ((String, String), (String, String))
15testEther = do
15testEther = do
16− s1 <- ask [tag|Tag1|]
16+ s1 <- ask @Tag1
17− s2 <- ask [tag|Tag2|]
17+ s2 <- ask @Tag2
18 let s1s2 = (s1, s2)
18 let s1s2 = (s1, s2)
19− s1s2' <- local [tag|Tag2|] (map succ) $ do
19+ s1s2' <- local @Tag2 (map succ) $ do
20− s1' <- ask [tag|Tag1|]
20+ s1' <- ask @Tag1
21− s2' <- ask [tag|Tag2|]
21+ s2' <- ask @Tag2
22 return (s1', s2')
22 return (s1', s2')
23 return (s1s2, s1s2')
23 return (s1s2, s1s2')
24
24
25−runner1 s1 s2 = flip (runReader [tag|Tag1|]) s1 . flip (runReaderT [tag|Tag2|]) s2
25+runner1 s1 s2 = flip (runReader @Tag1) s1 . flip (runReaderT @Tag2) s2
26−runner2 s1 s2 = flip (runReader [tag|Tag2|]) s2 . flip (runReaderT [tag|Tag1|]) s1
26+runner2 s1 s2 = flip (runReader @Tag2) s2 . flip (runReaderT @Tag1) s1
27
27
28test1 :: TestTree
28test1 :: TestTree
29test1 = testGroup "T1: Reader local environment"
29test1 = testGroup "T1: Reader local environment"
test/Regression/T3.hs+12−12
@@ -1,7 +1,7 @@
1module Regression.T3 (test3) where
1module Regression.T3 (test3) where
2
2
3import Control.Ether.Abbr
3import Control.Ether.Abbr
4−import Control.Monad.Ether
4+import Control.Monad.Ether.Ambiguous
5
5
6import qualified Control.Monad.Reader as T
6import qualified Control.Monad.Reader as T
7import qualified Control.Monad.State as T
7import qualified Control.Monad.State as T
@@ -22,21 +22,21 @@ testMTL = do
22testEther
22testEther
23 :: Ether '[STag --> Int, STag <-> Int, RTag --> Int] m
23 :: Ether '[STag --> Int, STag <-> Int, RTag --> Int] m
24 => m (Int, Int, Int)
24 => m (Int, Int, Int)
25−testEther = local [tag|RTag|] (*2) $ do
25+testEther = local @RTag (*2) $ do
26− a_mul_b <- tagAttach [tag|STag|] testMTL
26+ a_mul_b <- tagAttach @STag testMTL
27− a_add_b <- get [tag|STag|]
27+ a_add_b <- get @STag
28− modify [tag|STag|] negate
28+ modify @STag negate
29− c <- ask [tag|RTag|]
29+ c <- ask @RTag
30 return (a_mul_b, a_add_b, c)
30 return (a_mul_b, a_add_b, c)
31
31
32runner1 s r
32runner1 s r
33− = flip (runReader [tag|RTag|]) (negate r)
33+ = flip (runReader @RTag) (negate r)
34− . flip (runReaderT [tag|STag|]) r
34+ . flip (runReaderT @STag) r
35− . flip (runStateT [tag|STag|]) s
35+ . flip (runStateT @STag) s
36runner2 s r
36runner2 s r
37− = flip (runReader [tag|RTag|]) (negate r)
37+ = flip (runReader @RTag) (negate r)
38− . flip (runStateT [tag|STag|]) s
38+ . flip (runStateT @STag) s
39− . flip (runReaderT [tag|STag|]) r
39+ . flip (runReaderT @STag) r
40
40
41test3 :: TestTree
41test3 :: TestTree
42test3 = testGroup "T3: Tag attachement"
42test3 = testGroup "T3: Tag attachement"
test/Regression/T4.hs+4−4
@@ -1,7 +1,7 @@
1module Regression.T4 (test4) where
1module Regression.T4 (test4) where
2
2
3import Control.Ether.Abbr
3import Control.Ether.Abbr
4−import Control.Monad.Ether
4+import Control.Monad.Ether.Ambiguous
5
5
6import Test.Tasty
6import Test.Tasty
7import Test.Tasty.QuickCheck
7import Test.Tasty.QuickCheck
@@ -9,11 +9,11 @@ import Test.Tasty.QuickCheck
9data RTag
9data RTag
10
10
11testEther :: Ether '[RTag --> Int] m => m Int
11testEther :: Ether '[RTag --> Int] m => m Int
12−testEther = ask [tag|RTag|]
12+testEther = ask @RTag
13
13
14runner r
14runner r
15− = flip (runReader [tag|RTag|]) (r' :: Int)
15+ = flip (runReader @RTag) (r' :: Int)
16− . flip (runReaderT [tag|RTag|]) (r :: Int)
16+ . flip (runReaderT @RTag) (r :: Int)
17 where
17 where
18 r' = negate r
18 r' = negate r
19
19
test/Regression/T7.hs+4−4
@@ -3,7 +3,7 @@ module Regression.T7 (test7) where
3import Data.Monoid
3import Data.Monoid
4import Control.Monad
4import Control.Monad
5
5
6−import Control.Monad.Ether
6+import Control.Monad.Ether.Ambiguous
7import qualified Control.Monad.Writer as T
7import qualified Control.Monad.Writer as T
8
8
9import Test.Tasty
9import Test.Tasty
@@ -19,16 +19,16 @@ testEther
19testEther xs = do
19testEther xs = do
20 forM_ xs $ \x -> do
20 forM_ xs $ \x -> do
21 T.tell (Sum x)
21 T.tell (Sum x)
22− tell [tag|WTag|] (Sum 1)
22+ tell @WTag (Sum 1)
23
23
24runner1 :: Num a => [a] -> (a, a)
24runner1 :: Num a => [a] -> (a, a)
25runner1 xs =
25runner1 xs =
26− let (s, c) = T.runWriter . execWriterT [tag|WTag|] $ testEther xs
26+ let (s, c) = T.runWriter . execWriterT @WTag $ testEther xs
27 in (getSum s, getSum c)
27 in (getSum s, getSum c)
28
28
29runner2 :: Num a => [a] -> (a, a)
29runner2 :: Num a => [a] -> (a, a)
30runner2 xs =
30runner2 xs =
31− let (c, s) = runWriter [tag|WTag|] . T.execWriterT $ testEther xs
31+ let (c, s) = runWriter @WTag . T.execWriterT $ testEther xs
32 in (getSum s, getSum c)
32 in (getSum s, getSum c)
33
33
34triangular :: Integral a => a -> a
34triangular :: Integral a => a -> a
test/Regression/T8.hs+9−9
@@ -1,7 +1,7 @@
1module Regression.T8 (test8) where
1module Regression.T8 (test8) where
2
2
3import Control.Ether.Abbr
3import Control.Ether.Abbr
4−import Control.Monad.Ether
4+import Control.Monad.Ether.Ambiguous
5
5
6import qualified Control.Monad.State as T
6import qualified Control.Monad.State as T
7
7
@@ -21,22 +21,22 @@ testEther
21 :: Ether '[Foo <-> Int, Bar <-> Bool] m
21 :: Ether '[Foo <-> Int, Bar <-> Bool] m
22 => m String
22 => m String
23testEther = do
23testEther = do
24− tagAttach [tag|Foo|] testMTL1
24+ tagAttach @Foo testMTL1
25− tagAttach [tag|Bar|] testMTL2
25+ tagAttach @Bar testMTL2
26− a <- gets [tag|Foo|] show
26+ a <- gets @Foo show
27− b <- gets [tag|Bar|] show
27+ b <- gets @Bar show
28 return (a ++ b)
28 return (a ++ b)
29
29
30model :: Int -> Bool -> String
30model :: Int -> Bool -> String
31model a b = show (negate a) ++ show (not b)
31model a b = show (negate a) ++ show (not b)
32
32
33runner1 a b
33runner1 a b
34− = flip (evalState [tag|Foo|]) a
34+ = flip (evalState @Foo) a
35− . flip (evalStateT [tag|Bar|]) b
35+ . flip (evalStateT @Bar) b
36
36
37runner2 a b
37runner2 a b
38− = flip (evalState [tag|Bar|]) b
38+ = flip (evalState @Bar) b
39− . flip (evalStateT [tag|Foo|]) a
39+ . flip (evalStateT @Foo) a
40
40
41test8 :: TestTree
41test8 :: TestTree
42test8 = testGroup "T8: Multiple tag attachements"
42test8 = testGroup "T8: Multiple tag attachements"
test/Regression/T9.hs+8−8
@@ -1,7 +1,7 @@
1module Regression.T9 (test9) where
1module Regression.T9 (test9) where
2
2
3import Control.Ether.Abbr
3import Control.Ether.Abbr
4−import Control.Monad.Ether
4+import Control.Monad.Ether.Ambiguous
5
5
6import Test.Tasty
6import Test.Tasty
7import Test.Tasty.QuickCheck
7import Test.Tasty.QuickCheck
@@ -11,11 +11,11 @@ data Bar
11
11
12testEther1 :: Ether '[Foo <-> Int] m => m String
12testEther1 :: Ether '[Foo <-> Int] m => m String
13testEther1 = do
13testEther1 = do
14− modify [tag|Foo|] negate
14+ modify @Foo negate
15− gets [tag|Foo|] show
15+ gets @Foo show
16
16
17testEther2 :: Ether '[Bar <-> Int] m => m String
17testEther2 :: Ether '[Bar <-> Int] m => m String
18−testEther2 = tagReplace [tag|Foo|] [tag|Bar|] testEther1
18+testEther2 = tagReplace @Foo @Bar testEther1
19
19
20testEther
20testEther
21 :: Ether '[Foo <-> Int, Bar <-> Int] m
21 :: Ether '[Foo <-> Int, Bar <-> Int] m
@@ -29,12 +29,12 @@ model :: Int -> Int -> String
29model a b = show (negate a) ++ show (negate b)
29model a b = show (negate a) ++ show (negate b)
30
30
31runner1 a b
31runner1 a b
32− = flip (evalState [tag|Foo|]) a
32+ = flip (evalState @Foo) a
33− . flip (evalStateT [tag|Bar|]) b
33+ . flip (evalStateT @Bar) b
34
34
35runner2 a b
35runner2 a b
36− = flip (evalState [tag|Bar|]) b
36+ = flip (evalState @Bar) b
37− . flip (evalStateT [tag|Foo|]) a
37+ . flip (evalStateT @Foo) a
38
38
39test9 :: TestTree
39test9 :: TestTree
40test9 = testGroup "T9: Tag replacement"
40test9 = testGroup "T9: Tag replacement"