on master help sign in
Merge ether, ether-flatten, ether-zoom
commit69dba57d26108bcc428fcd77c540e918052e2c58 authorVladislav Zavialov <vlad.z.4096@gmail.com> dateMon 24 Apr 2017, 01:54 (9 years ago) parent3f21404
18 files changed+29−215
cabal.project−2 ether-flatten/CHANGELOG.md ether-flatten/LICENSE−30 ether-flatten/Setup.hs−2 ether-flatten/ether-flatten.cabal−72 ether-suite/ether-suite.cabal+2−4 ether-zoom/CHANGELOG.md ether-zoom/LICENSE−30 ether-zoom/Setup.hs−2 ether-zoom/ether-zoom.cabal−65 ether/CHANGELOG.md+2 ether/ether.cabal+5−1 ether/src/Control/Ether/Optic.hs+3 ether/src/Control/Monad/Ether/Except/Class.hs+4 ether-flatten/src/Control/Monad/Ether/Reader/Flatten.hs → ether/src/Control/Monad/Ether/Reader/Flatten.hs+4−2 ether-flatten/src/Control/Monad/Ether/State/Flatten.hs → ether/src/Control/Monad/Ether/State/Flatten.hs+4−2 ether-zoom/src/Control/Monad/Ether/State/Zoom.hs → ether/src/Control/Monad/Ether/State/Zoom.hs+5−1 stack.yaml−2
cabal.project−2
@@ -1,5 +1,3 @@
11packages:
22 ether/
3− ether-zoom/
4− ether-flatten/
53 ether-suite/
ether-flatten/CHANGELOG.mddeleted

No changes to the content.

ether-flatten/LICENSEdeleted−30
@@ -1,30 +0,0 @@
1−Copyright (c) 2017, Vladislav Zavialov
2−
3−All rights reserved.
4−
5−Redistribution and use in source and binary forms, with or without
6−modification, are permitted provided that the following conditions are met:
7−
8− * Redistributions of source code must retain the above copyright
9− notice, this list of conditions and the following disclaimer.
10−
11− * Redistributions in binary form must reproduce the above
12− copyright notice, this list of conditions and the following
13− disclaimer in the documentation and/or other materials provided
14− with the distribution.
15−
16− * Neither the name of Vladislav Zavialov nor the names of other
17− contributors may be used to endorse or promote products derived
18− from this software without specific prior written permission.
19−
20−THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21−"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22−LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23−A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24−OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25−SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26−LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27−DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28−THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29−(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30−OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ether-flatten/Setup.hsdeleted−2
@@ -1,2 +0,0 @@
1−import Distribution.Simple
2−main = defaultMain
ether-flatten/ether-flatten.cabaldeleted−72
@@ -1,72 +0,0 @@
1−name: ether-flatten
2−version: 0.1.0.0
3−synopsis: Flatten nested monad transformers
4−description:
5− Flatten nested monad transformers to gain performance.
6−
7−category: Control
8−license: BSD3
9−license-file: LICENSE
10−author: Vladislav Zavialov
11−maintainer: Vladislav Zavialov <vlad.z.4096@gmail.com>
12−homepage: https://int-index.github.io/ether/
13−bug-reports: https://github.com/int-index/ether/issues
14−build-type: Simple
15−cabal-version: >=1.18
16−extra-source-files: CHANGELOG.md
17−
18−source-repository head
19−
20− type: git
21− location: git@github.com:int-index/ether.git
22−
23−
24−library
25−
26− exposed-modules:
27− Control.Monad.Ether.Reader.Flatten
28− Control.Monad.Ether.State.Flatten
29−
30− build-depends:
31− base >=4.9 && <4.11,
32− ether >=0.5 && <0.6,
33− mtl >=2.2.1,
34− transformers >=0.4.2,
35− transformers-lift >=0.1.0.1,
36− ghc-prim >=0.3,
37− lens >=4.14,
38− deepseq >= 1.4
39−
40− default-language:
41− Haskell2010
42−
43− default-extensions:
44− AllowAmbiguousTypes
45− ConstraintKinds
46− DataKinds
47− DeriveGeneric
48− EmptyDataDecls
49− FlexibleContexts
50− FlexibleInstances
51− FunctionalDependencies
52− GADTs
53− GeneralizedNewtypeDeriving
54− PartialTypeSignatures
55− PolyKinds
56− ScopedTypeVariables
57− RankNTypes
58− TemplateHaskell
59− TupleSections
60− TypeApplications
61− TypeFamilies
62− TypeInType
63− TypeOperators
64− TypeSynonymInstances
65− UndecidableInstances
66− UndecidableSuperClasses
67−
68− hs-source-dirs:
69− src
70−
71− ghc-options:
72− -Wall -O2
ether-suite/ether-suite.cabal+2−4
@@ -18,8 +18,7 @@ test-suite regression
1818 QuickCheck >=2.8,
1919 ghc-prim >=0.3,
2020 lens >=4.14,
21− ether,
22− ether-zoom
21+ ether
2322
2423 main-is:
2524 Regression.hs
@@ -85,8 +84,7 @@ benchmark bench
8584 criterion >=1.1,
8685 deepseq >=1.4,
8786 lens >=4.14,
88− ether,
89− ether-flatten
87+ ether
9088
9189 main-is:
9290 Bench.hs
ether-zoom/CHANGELOG.mddeleted

No changes to the content.

ether-zoom/LICENSEdeleted−30
@@ -1,30 +0,0 @@
1−Copyright (c) 2017, Vladislav Zavialov
2−
3−All rights reserved.
4−
5−Redistribution and use in source and binary forms, with or without
6−modification, are permitted provided that the following conditions are met:
7−
8− * Redistributions of source code must retain the above copyright
9− notice, this list of conditions and the following disclaimer.
10−
11− * Redistributions in binary form must reproduce the above
12− copyright notice, this list of conditions and the following
13− disclaimer in the documentation and/or other materials provided
14− with the distribution.
15−
16− * Neither the name of Vladislav Zavialov nor the names of other
17− contributors may be used to endorse or promote products derived
18− from this software without specific prior written permission.
19−
20−THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21−"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22−LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23−A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24−OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25−SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26−LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27−DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28−THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29−(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30−OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ether-zoom/Setup.hsdeleted−2
@@ -1,2 +0,0 @@
1−import Distribution.Simple
2−main = defaultMain
ether-zoom/ether-zoom.cabaldeleted−65
@@ -1,65 +0,0 @@
1−name: ether-zoom
2−version: 0.1.0.0
3−synopsis: Zoom for the state monad
4−description:
5− Zoom into parts of a state using a lens.
6−
7−category: Control
8−license: BSD3
9−license-file: LICENSE
10−author: Vladislav Zavialov
11−maintainer: Vladislav Zavialov <vlad.z.4096@gmail.com>
12−homepage: https://int-index.github.io/ether/
13−bug-reports: https://github.com/int-index/ether/issues
14−build-type: Simple
15−cabal-version: >=1.18
16−extra-source-files: CHANGELOG.md
17−
18−source-repository head
19−
20− type: git
21− location: git@github.com:int-index/ether.git
22−
23−
24−library
25−
26− exposed-modules:
27− Control.Monad.Ether.State.Zoom
28−
29− build-depends:
30− base >=4.9 && <4.11,
31− ether >=0.5 && <0.6,
32− transformers >=0.5,
33− lens >=4.14,
34− reflection >=2.1
35−
36− default-extensions:
37− AllowAmbiguousTypes
38− ConstraintKinds
39− DataKinds
40− DeriveGeneric
41− EmptyDataDecls
42− FlexibleContexts
43− FlexibleInstances
44− FunctionalDependencies
45− GADTs
46− GeneralizedNewtypeDeriving
47− PartialTypeSignatures
48− PolyKinds
49− ScopedTypeVariables
50− RankNTypes
51− TemplateHaskell
52− TupleSections
53− TypeApplications
54− TypeFamilies
55− TypeInType
56− TypeOperators
57− TypeSynonymInstances
58− UndecidableInstances
59− UndecidableSuperClasses
60−
61− hs-source-dirs:
62− src
63−
64− ghc-options:
65− -Wall -O2
ether/CHANGELOG.md+2
@@ -6,6 +6,8 @@
66* Remove `Control.Ether.TH`.
77* Unify `Dispatch` and `TaggedTrans` as `Handler`.
88* Better `MonadBase` and `MonadBaseControl` instances.
9+* Add flattening for `ReaderT` and `StateT`.
10+* Add zooming for `MonadState`.
911
10120.4.1.0
1113-------
ether/ether.cabal+5−1
@@ -37,12 +37,15 @@ library
3737 Control.Monad.Ether.TagReplace
3838 Control.Monad.Ether.Reader
3939 Control.Monad.Ether.Reader.Class
40+ Control.Monad.Ether.Reader.Flatten
4041 Control.Monad.Ether.Writer
4142 Control.Monad.Ether.Writer.Class
4243 Control.Monad.Ether.State
4344 Control.Monad.Ether.State.Class
4445 Control.Monad.Ether.State.Lazy
4546 Control.Monad.Ether.State.Strict
47+ Control.Monad.Ether.State.Flatten
48+ Control.Monad.Ether.State.Zoom
4649 Control.Monad.Ether.Except
4750 Control.Monad.Ether.Except.Class
4851 Control.Monad.Ether.Implicit
@@ -66,7 +69,8 @@ library
6669 transformers-base >=0.4.4,
6770 exceptions >=0.8,
6871 template-haskell >=2.11,
69− tagged >=0.8.5
72+ tagged >=0.8.5,
73+ reflection >=2.1
7074
7175 default-language:
7276 Haskell2010
ether/src/Control/Ether/Optic.hs+3
@@ -3,6 +3,9 @@ module Control.Ether.Optic
33 , TagsK
44 , Tags
55 , HasLens(..)
6+ , LensLike
7+ , Lens
8+ , Lens'
69 , view
710 , over
811 , HList(..)
ether/src/Control/Monad/Ether/Except/Class.hs+4
@@ -21,5 +21,9 @@ instance {-# OVERLAPPABLE #-}
2121 , Monad (t m)
2222 , MonadExcept tag e m
2323 ) => MonadExcept tag e (t m) where
24+
2425 throw = Lift.lift . throw @tag
26+ {-# INLINE throw #-}
27+
2528 catch = Lift.liftCatch (catch @tag)
29+ {-# INLINE catch #-}
ether-flatten/src/Control/Monad/Ether/Reader/Flatten.hs → ether/src/Control/Monad/Ether/Reader/Flatten.hsrenamed+4−2
@@ -1,15 +1,17 @@
11module Control.Monad.Ether.Reader.Flatten
2− ( runReader
2+ ( ReaderT
33 , runReaderT
4+ , Reader
5+ , runReader
46 ) where
57
68import Control.Ether.Optic
7−import Control.Lens
89import Control.Monad.Ether.Handle
910import Control.Monad.Ether.Reader (READER)
1011import qualified Control.Monad.Reader as T
1112import Control.Monad.Trans.Ether.Handler
1213import Data.Coerce
14+import Data.Functor.Identity
1315import Data.Kind
1416
1517type family READERS (ts :: HList xs) :: [Type] where
ether-flatten/src/Control/Monad/Ether/State/Flatten.hs → ether/src/Control/Monad/Ether/State/Flatten.hsrenamed+4−2
@@ -1,15 +1,17 @@
11module Control.Monad.Ether.State.Flatten
2− ( runState
2+ ( StateT
33 , runStateT
4+ , State
5+ , runState
46 ) where
57
68import Control.Ether.Optic
7−import Control.Lens
89import Control.Monad.Ether.Handle
910import Control.Monad.Ether.State (STATE)
1011import qualified Control.Monad.State as T
1112import Control.Monad.Trans.Ether.Handler
1213import Data.Coerce
14+import Data.Functor.Identity
1315import Data.Kind
1416
1517type family STATES (ts :: HList xs) :: [Type] where
ether-zoom/src/Control/Monad/Ether/State/Zoom.hs → ether/src/Control/Monad/Ether/State/Zoom.hsrenamed+5−1
@@ -6,8 +6,8 @@ module Control.Monad.Ether.State.Zoom
66 , tagZoom
77 ) where
88
9+import Control.Ether.Optic
910import Data.Kind as K
10−import Control.Lens
1111import Data.Reflection
1212import Control.Monad.Trans.Ether.Handler
1313import Control.Monad.Trans.Identity
@@ -20,6 +20,10 @@ data TAG_ZOOM t z
2020
2121type TagZoomT t (z :: K.Type) = Handler (TAG_ZOOM t z) IdentityT
2222
23+newtype ReifiedLens s t a b = Lens { runLens :: Lens s t a b }
24+
25+type ReifiedLens' s a = ReifiedLens s s a a
26+
2327-- | Zoom into a part of a state using a lens.
2428tagZoom
2529 :: forall tag sOuter sInner m a
stack.yaml−2
@@ -2,6 +2,4 @@ resolver: lts-8.12
22
33packages:
44- 'ether'
5−- 'ether-flatten'
6−- 'ether-zoom'
75- 'ether-suite'