on f9bd91a help sign in
26 files changed+171−156
since splitsnapshots
unifiedsplit
.gitignore+2−17 .travis.yml+18−25 CHANGELOG.md−5 README.md+16 bench/Bench.hs−1 bench/TupleInstances.hs−9 ether.cabal+26−38 shell.nix−22 src/Ether/Internal.hs+3−3 src/Ether/Internal/TupleInstances.hs−24 src/Ether/Internal/TupleInstances_HasLens.hs+11 src/Ether/Internal/TupleInstances_HasLens_1.hs+7 src/Ether/Internal/TupleInstances_HasLens_2.hs+7 src/Ether/Internal/TupleInstances_HasLens_3.hs+7 src/Ether/Internal/TupleInstances_HasLens_4.hs+7 src/Ether/Internal/TupleInstances_HasLens_5.hs+7 src/Ether/Internal/TupleInstances_HasLens_6.hs+7 src/Ether/Internal/TupleInstances_HasLens_7.hs+7 src/Ether/Internal/TupleInstances_HasLens_8.hs+7 src/Ether/Internal/TupleInstances_HasLens_9.hs+7 src/Ether/Internal/TupleInstances_Tags.hs+13 src/Ether/Internal/TupleInstances_TagsK.hs+12 src/Ether/Reader.hs+2−2 stack.yaml+5 test/Regression/T1.hs−1 test/TupleInstances.hs−9
.gitignore+2−17
@@ -1,21 +1,6 @@
1−# Cabal
1+tags
22dist
33dist-newstyle
4+.stack-work
45.cabal-sandbox/
56cabal.sandbox.config
6−cabal.project.local
7−.ghc.environment*
8−
9−# Profiling
10−*.prof
11−
12−# Stack
13−.stack-work
14−
15−# Emacs
16−TAGS
17−.dir-locals.el
18−
19−# Vim
20−tags
21−*.swp
.travis.yml+18−25
@@ -1,31 +1,24 @@
1−language: nix
1+sudo: false
22
3−os:
4− - linux
5− - osx
6−
7−env:
8− - HC=ghc822
9− - HC=ghc844
10− - HC=ghc861
3+cache:
4+ directories:
5+ - $HOME/.stack/
116
127before_install:
13− - curl https://raw.githubusercontent.com/monadfix/nix-cabal/master/nix-cabal -o nix-cabal && chmod u+x nix-cabal
14− - travis_retry ./nix-cabal new-update
8+ - mkdir -p ~/.local/bin
9+ - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
10+ - export PATH=~/.local/bin:$PATH
11+ - stack --version
12+ - stack setup
1513
16−script:
17− - ./nix-cabal new-test ether:regression
18− - ./nix-cabal new-bench ether:bench
14+install:
15+ - stack install --only-dependencies --no-terminal
1916
20−cache:
21− directories:
22− - ~/.cabal
23− - ~/.ghc
17+script:
18+ - stack test ether:regression --no-terminal --ghc-options -Werror
19+ - stack bench ether:bench --no-terminal --ghc-options -Werror
2420
25−matrix:
26− # broken at the moment
27− exclude:
28− - os: osx
29− env: HC=ghc822
30− - os: osx
31− env: HC=ghc861
21+addons:
22+ apt:
23+ packages:
24+ - libgmp-dev
CHANGELOG.md−5
@@ -1,8 +1,3 @@
1−0.5.1.0
2−-------
3−
4−* Disable `HasLens` for tuples via cabal flag.
5−
610.5.0.0
72-------
83
README.md+16
@@ -2,8 +2,24 @@
22
33[![Build Status](https://img.shields.io/travis/int-index/ether.svg)](https://travis-ci.org/int-index/ether)
44[![Hackage](https://img.shields.io/hackage/v/ether.svg)](https://hackage.haskell.org/package/ether)
5+[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/int-index/ether)
56
67
78Ether is a Haskell library that extends [mtl](https://hackage.haskell.org/package/mtl)
89and [transformers](https://hackage.haskell.org/package/transformers) with tagged
910monad transformers and classes in a compatible way.
11+
12+## Installation
13+
14+You can install `ether 0.4.0.0`
15+
16+1. using Cabal, from Hackage;
17+2. using Stack, from Stackage;
18+3. using Portage, from Gentoo Haskell Overlay.
19+
20+If unsure, use [Stack](https://github.com/commercialhaskell/stack).
21+
22+## Getting Started
23+
24+To get started, read the introduction on the [homepage](https://int-index.github.io/ether/).
25+If you need help with Ether or if you have any questions about it, ask me in the Gitter chat.
bench/Bench.hs−1
@@ -8,7 +8,6 @@ import qualified Control.Monad.Reader as M
88import qualified Control.Monad.State as M
99import Criterion.Main
1010import Ether
11−import TupleInstances ()
1211
1312id' :: a -> a
1413id' = id
bench/TupleInstances.hsdeleted−9
@@ -1,9 +0,0 @@
1−{-# OPTIONS -fno-warn-orphans #-}
2−{-# LANGUAGE CPP #-}
3−
4−module TupleInstances () where
5−
6−#ifdef DISABLE_TUP_INSTANCES
7−import Ether.Internal (makeTupleInstancesHasLens)
8−makeTupleInstancesHasLens [4,5,9]
9−#endif
ether.cabal+26−38
@@ -1,17 +1,21 @@
1−cabal-version: 2.2
21name: ether
3−version: 0.5.2.0
2+version: 0.5.0.0
43synopsis: Monad transformers and classes
5−description: Lib
6−license: BSD-3-Clause
7−-- ^ unfortunately have to change this line due to the issue with cabal2nix
8−license-file: LICENSE
4+description:
5+ Ether is a Haskell library that extends @mtl@ and @transformers@ with
6+ tagged monad transformers and classes in a compatible way.
7+
8+ Introduction <https://int-index.github.io/ether/>
9+
910category: Control
11+license: BSD3
12+license-file: LICENSE
1013author: Vladislav Zavialov
1114maintainer: Vladislav Zavialov <vlad.z.4096@gmail.com>
1215homepage: https://int-index.github.io/ether/
1316bug-reports: https://github.com/int-index/ether/issues
1417build-type: Simple
18+cabal-version: >=1.18
1519extra-source-files: CHANGELOG.md
1620
1721source-repository head
@@ -20,20 +24,6 @@ source-repository head
2024 location: git@github.com:int-index/ether.git
2125
2226
23−flag disable-tup-instances
24−
25− description:
26− Disable auto-generated 'HasLens' instances for tuples. The reason one
27− might want to do this is to reduce the size of .hi-files, as well as the
28− time and memory GHC needs to build Ether. To recover flattening with
29− tuples, use 'Ether.Internal.makeTupleInstancesHasLens' at specific tuple
30− sizes you need in your application.
31−
32− This is a build-time performance hack, enable this flag at your own risk.
33−
34− default: False
35− manual: True
36−
3727library
3828
3929 exposed-modules:
@@ -51,13 +41,24 @@ library
5141 Ether.Internal.HasLens
5242 Ether.Internal.TH_Utils
5343 Ether.Internal.TH_TupleInstances
54− Ether.Internal.TupleInstances
44+ Ether.Internal.TupleInstances_TagsK
45+ Ether.Internal.TupleInstances_Tags
46+ Ether.Internal.TupleInstances_HasLens
47+ Ether.Internal.TupleInstances_HasLens_1
48+ Ether.Internal.TupleInstances_HasLens_2
49+ Ether.Internal.TupleInstances_HasLens_3
50+ Ether.Internal.TupleInstances_HasLens_4
51+ Ether.Internal.TupleInstances_HasLens_5
52+ Ether.Internal.TupleInstances_HasLens_6
53+ Ether.Internal.TupleInstances_HasLens_7
54+ Ether.Internal.TupleInstances_HasLens_8
55+ Ether.Internal.TupleInstances_HasLens_9
5556
5657 build-depends:
57− base >=4.9 && <4.13,
58+ base >=4.9 && <4.11,
5859 transformers >=0.5.2.0,
5960 transformers-lift >=0.2.0.1,
60− mtl >=2.2.2,
61+ mtl >=2.2.1,
6162 mmorph >=1.0.4,
6263 monad-control >=1.0.0.4,
6364 transformers-base >=0.4.4,
@@ -101,13 +102,10 @@ library
101102 ghc-options:
102103 -Wall -O2
103104
104− if flag(disable-tup-instances)
105− cpp-options: -DDISABLE_TUP_INSTANCES
106−
107105test-suite regression
108106
109107 build-depends:
110− base >=4.9 && <4.13,
108+ base >=4.9 && <4.11,
111109 transformers >=0.4.2,
112110 mtl >=2.2.1,
113111 tasty >=0.10,
@@ -121,7 +119,6 @@ test-suite regression
121119 Regression.hs
122120
123121 other-modules:
124− TupleInstances
125122 Regression.T1
126123 Regression.T2
127124 Regression.T3
@@ -172,14 +169,11 @@ test-suite regression
172169 ghc-options:
173170 -Wall -fno-warn-missing-signatures
174171
175− if flag(disable-tup-instances)
176− cpp-options: -DDISABLE_TUP_INSTANCES
177−
178172
179173benchmark bench
180174
181175 build-depends:
182− base >=4.9 && <4.13,
176+ base >=4.9 && <4.11,
183177 mtl >=2.2.1,
184178 transformers >=0.4.2,
185179 criterion >=1.1,
@@ -190,9 +184,6 @@ benchmark bench
190184 main-is:
191185 Bench.hs
192186
193− other-modules:
194− TupleInstances
195−
196187 type:
197188 exitcode-stdio-1.0
198189
@@ -232,6 +223,3 @@ benchmark bench
232223
233224 ghc-prof-options:
234225 -fprof-auto
235−
236− if flag(disable-tup-instances)
237− cpp-options: -DDISABLE_TUP_INSTANCES
shell.nixdeleted−22
@@ -1,22 +0,0 @@
1−{ pkgs ? import <nixpkgs> {},
2− hc ? "ghc844"
3−}:
4−
5−pkgs.stdenv.mkDerivation rec {
6− name = "ether";
7− buildInputs = [
8− pkgs.haskell.compiler.${hc}
9− pkgs.git
10− pkgs.zlib
11− pkgs.cabal-install
12− pkgs.pkgconfig
13− ];
14− shellHook = ''
15− export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH
16− export LANG=en_US.UTF-8
17− '';
18− LOCALE_ARCHIVE =
19− if pkgs.stdenv.isLinux
20− then "${pkgs.glibcLocales}/lib/locale/locale-archive"
21− else "";
22−}
src/Ether/Internal.hs+3−3
@@ -16,7 +16,6 @@ module Ether.Internal
1616 , HandleSuper
1717 , HandleConstraint
1818 , Handle(..)
19− , makeTupleInstancesHasLens
2019 ) where
2120
2221import Control.Applicative
@@ -28,8 +27,9 @@ import GHC.Exts (Constraint)
2827
2928import Ether.Internal.HasLens
3029import Ether.Internal.Tags
31−import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
32−import Ether.Internal.TupleInstances ()
30+import Ether.Internal.TupleInstances_Tags ()
31+import Ether.Internal.TupleInstances_TagsK ()
32+import Ether.Internal.TupleInstances_HasLens ()
3333
3434data TAGGED e t
3535
src/Ether/Internal/TupleInstances.hsdeleted−24
@@ -1,24 +0,0 @@
1−{-# OPTIONS -fno-warn-orphans #-}
2−{-# LANGUAGE CPP #-}
3−
4−module Ether.Internal.TupleInstances () where
5−
6−import Data.Tagged
7−import Ether.Internal.Tags
8−import Ether.Internal.TH_TupleInstances
9−
10−type instance TagsK () = '[]
11−type instance TagsK (Tagged t a) = '[KindOf t]
12−type instance TagsK (Tagged t0 a, Tagged t1 b) = '[KindOf t0, KindOf t1]
13−
14−makeTupleInstancesTagsK
15−
16−type instance Tags () = 'HNil
17−type instance Tags (Tagged t a) = 'HCons t 'HNil
18−type instance Tags (Tagged t0 a, Tagged t1 b) = 'HCons t0 ('HCons t1 'HNil)
19−
20−makeTupleInstancesTags
21−
22−#ifndef DISABLE_TUP_INSTANCES
23−makeTupleInstancesHasLens [2..62]
24−#endif
src/Ether/Internal/TupleInstances_HasLens.hsnew file+11
@@ -0,0 +1,11 @@
1+module Ether.Internal.TupleInstances_HasLens () where
2+
3+import Ether.Internal.TupleInstances_HasLens_1 ()
4+import Ether.Internal.TupleInstances_HasLens_2 ()
5+import Ether.Internal.TupleInstances_HasLens_3 ()
6+import Ether.Internal.TupleInstances_HasLens_4 ()
7+import Ether.Internal.TupleInstances_HasLens_5 ()
8+import Ether.Internal.TupleInstances_HasLens_6 ()
9+import Ether.Internal.TupleInstances_HasLens_7 ()
10+import Ether.Internal.TupleInstances_HasLens_8 ()
11+import Ether.Internal.TupleInstances_HasLens_9 ()
src/Ether/Internal/TupleInstances_HasLens_1.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# OPTIONS -fno-warn-orphans #-}
2+
3+module Ether.Internal.TupleInstances_HasLens_1 () where
4+
5+import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
6+
7+makeTupleInstancesHasLens [2..20]
src/Ether/Internal/TupleInstances_HasLens_2.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# OPTIONS -fno-warn-orphans #-}
2+
3+module Ether.Internal.TupleInstances_HasLens_2 () where
4+
5+import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
6+
7+makeTupleInstancesHasLens [21..29]
src/Ether/Internal/TupleInstances_HasLens_3.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# OPTIONS -fno-warn-orphans #-}
2+
3+module Ether.Internal.TupleInstances_HasLens_3 () where
4+
5+import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
6+
7+makeTupleInstancesHasLens [30..36]
src/Ether/Internal/TupleInstances_HasLens_4.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# OPTIONS -fno-warn-orphans #-}
2+
3+module Ether.Internal.TupleInstances_HasLens_4 () where
4+
5+import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
6+
7+makeTupleInstancesHasLens [37..42]
src/Ether/Internal/TupleInstances_HasLens_5.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# OPTIONS -fno-warn-orphans #-}
2+
3+module Ether.Internal.TupleInstances_HasLens_5 () where
4+
5+import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
6+
7+makeTupleInstancesHasLens [43..47]
src/Ether/Internal/TupleInstances_HasLens_6.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# OPTIONS -fno-warn-orphans #-}
2+
3+module Ether.Internal.TupleInstances_HasLens_6 () where
4+
5+import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
6+
7+makeTupleInstancesHasLens [48..52]
src/Ether/Internal/TupleInstances_HasLens_7.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# OPTIONS -fno-warn-orphans #-}
2+
3+module Ether.Internal.TupleInstances_HasLens_7 () where
4+
5+import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
6+
7+makeTupleInstancesHasLens [53..56]
src/Ether/Internal/TupleInstances_HasLens_8.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# OPTIONS -fno-warn-orphans #-}
2+
3+module Ether.Internal.TupleInstances_HasLens_8 () where
4+
5+import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
6+
7+makeTupleInstancesHasLens [57..60]
src/Ether/Internal/TupleInstances_HasLens_9.hsnew file+7
@@ -0,0 +1,7 @@
1+{-# OPTIONS -fno-warn-orphans #-}
2+
3+module Ether.Internal.TupleInstances_HasLens_9 () where
4+
5+import Ether.Internal.TH_TupleInstances (makeTupleInstancesHasLens)
6+
7+makeTupleInstancesHasLens [61..62]
src/Ether/Internal/TupleInstances_Tags.hsnew file+13
@@ -0,0 +1,13 @@
1+module Ether.Internal.TupleInstances_Tags () where
2+
3+import Data.Tagged
4+
5+import Ether.Internal.Tags
6+import Ether.Internal.TupleInstances_TagsK ()
7+import Ether.Internal.TH_TupleInstances (makeTupleInstancesTags)
8+
9+type instance Tags () = 'HNil
10+type instance Tags (Tagged t a) = 'HCons t 'HNil
11+type instance Tags (Tagged t0 a, Tagged t1 b) = 'HCons t0 ('HCons t1 'HNil)
12+
13+makeTupleInstancesTags
src/Ether/Internal/TupleInstances_TagsK.hsnew file+12
@@ -0,0 +1,12 @@
1+module Ether.Internal.TupleInstances_TagsK () where
2+
3+import Data.Tagged
4+
5+import Ether.Internal.Tags
6+import Ether.Internal.TH_TupleInstances (makeTupleInstancesTagsK)
7+
8+type instance TagsK () = '[]
9+type instance TagsK (Tagged t a) = '[KindOf t]
10+type instance TagsK (Tagged t0 a, Tagged t1 b) = '[KindOf t0, KindOf t1]
11+
12+makeTupleInstancesTagsK
src/Ether/Reader.hs+2−2
@@ -139,7 +139,7 @@ readerT = coerce (T.ReaderT @r @m @a)
139139-- | Runs a 'ReaderT' with the given environment
140140-- and returns the final value.
141141runReaderT :: forall tag r m a . ReaderT tag r m a -> r -> m a
142−runReaderT = coerce (T.runReaderT @r @m @a)
142+runReaderT = coerce (T.runReaderT @r @_ @m @a)
143143
144144-- | Runs a 'ReaderT' with the given environment
145145-- and returns the final value.
@@ -203,7 +203,7 @@ type ReadersT r = TaggedTrans (READERS (Tags r)) (T.ReaderT r)
203203type Readers r = ReadersT r Identity
204204
205205runReadersT :: forall p m a . ReadersT p m a -> p -> m a
206−runReadersT = coerce (T.runReaderT @p @m @a)
206+runReadersT = coerce (T.runReaderT @p @_ @m @a)
207207
208208runReaders :: forall p a . Readers p a -> p -> a
209209runReaders = coerce (T.runReader @p @a)
stack.yamlnew file+5
@@ -0,0 +1,5 @@
1+resolver: lts-7.23
2+packages: ['.']
3+extra-deps:
4+- transformers-lift-0.2.0.1
5+- mmorph-1.1.0
test/Regression/T1.hs−1
@@ -1,7 +1,6 @@
11module Regression.T1 (test1) where
22
33import Ether
4−import TupleInstances ()
54import Data.List (group)
65
76import Test.Tasty
test/TupleInstances.hsdeleted−9
@@ -1,9 +0,0 @@
1−{-# OPTIONS -fno-warn-orphans #-}
2−{-# LANGUAGE CPP #-}
3−
4−module TupleInstances () where
5−
6−#ifdef DISABLE_TUP_INSTANCES
7−import Ether.Internal (makeTupleInstancesHasLens)
8−makeTupleInstancesHasLens [2]
9−#endif