summaryrefslogtreecommitdiff
path: root/standalone/no-th/haskell-patches/lens_no-TH.patch
blob: ffcf0027ec792d429bd503b6b9a06a4b3b287d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
From 2b5fa1851a84f58b43e7c4224bd5695a32a80de9 Mon Sep 17 00:00:00 2001
From: dummy <dummy@example.com>
Date: Wed, 18 Dec 2013 03:27:54 +0000
Subject: [PATCH] avoid TH

---
 lens.cabal                             | 13 +------------
 src/Control/Lens.hs                    |  4 ++--
 src/Control/Lens/Internal/Exception.hs | 30 ------------------------------
 src/Control/Lens/Prism.hs              |  2 --
 4 files changed, 3 insertions(+), 46 deletions(-)

diff --git a/lens.cabal b/lens.cabal
index 8477892..a6ac7a5 100644
--- a/lens.cabal
+++ b/lens.cabal
@@ -10,7 +10,7 @@ stability:     provisional
 homepage:      http://github.com/ekmett/lens/
 bug-reports:   http://github.com/ekmett/lens/issues
 copyright:     Copyright (C) 2012-2013 Edward A. Kmett
-build-type:    Custom
+build-type:    Simple
 tested-with:   GHC == 7.6.3
 synopsis:      Lenses, Folds and Traversals
 description:
@@ -173,7 +173,6 @@ library
     containers                >= 0.4.0    && < 0.6,
     distributive              >= 0.3      && < 1,
     filepath                  >= 1.2.0.0  && < 1.4,
-    generic-deriving          >= 1.4      && < 1.7,
     ghc-prim,
     hashable                  >= 1.1.2.3  && < 1.3,
     MonadCatchIO-transformers >= 0.3      && < 0.4,
@@ -235,14 +234,12 @@ library
     Control.Lens.Review
     Control.Lens.Setter
     Control.Lens.Simple
-    Control.Lens.TH
     Control.Lens.Traversal
     Control.Lens.Tuple
     Control.Lens.Type
     Control.Lens.Wrapped
     Control.Lens.Zipper
     Control.Lens.Zoom
-    Control.Monad.Error.Lens
     Control.Parallel.Strategies.Lens
     Control.Seq.Lens
     Data.Array.Lens
@@ -266,12 +263,8 @@ library
     Data.Typeable.Lens
     Data.Vector.Lens
     Data.Vector.Generic.Lens
-    Generics.Deriving.Lens
-    GHC.Generics.Lens
     System.Exit.Lens
     System.FilePath.Lens
-    System.IO.Error.Lens
-    Language.Haskell.TH.Lens
     Numeric.Lens
 
   if flag(safe)
@@ -370,7 +363,6 @@ test-suite doctests
       deepseq,
       doctest        >= 0.9.1,
       filepath,
-      generic-deriving,
       mtl,
       nats,
       parallel,
@@ -396,7 +388,6 @@ benchmark plated
     comonad,
     criterion,
     deepseq,
-    generic-deriving,
     lens,
     transformers
 
@@ -431,7 +422,6 @@ benchmark unsafe
     comonads-fd,
     criterion,
     deepseq,
-    generic-deriving,
     lens,
     transformers
 
@@ -448,6 +438,5 @@ benchmark zipper
     comonads-fd,
     criterion,
     deepseq,
-    generic-deriving,
     lens,
     transformers
diff --git a/src/Control/Lens.hs b/src/Control/Lens.hs
index f7c6548..125153e 100644
--- a/src/Control/Lens.hs
+++ b/src/Control/Lens.hs
@@ -59,7 +59,7 @@ module Control.Lens
   , module Control.Lens.Review
   , module Control.Lens.Setter
   , module Control.Lens.Simple
-#ifndef DISABLE_TEMPLATE_HASKELL
+#if 0
   , module Control.Lens.TH
 #endif
   , module Control.Lens.Traversal
@@ -89,7 +89,7 @@ import Control.Lens.Reified
 import Control.Lens.Review
 import Control.Lens.Setter
 import Control.Lens.Simple
-#ifndef DISABLE_TEMPLATE_HASKELL
+#if 0
 import Control.Lens.TH
 #endif
 import Control.Lens.Traversal
diff --git a/src/Control/Lens/Internal/Exception.hs b/src/Control/Lens/Internal/Exception.hs
index 387203e..bb1ca10 100644
--- a/src/Control/Lens/Internal/Exception.hs
+++ b/src/Control/Lens/Internal/Exception.hs
@@ -128,18 +128,6 @@ class Handleable e (m :: * -> *) (h :: * -> *) | h -> e m where
   handler_ l = handler l . const
   {-# INLINE handler_ #-}
 
-instance Handleable SomeException IO Exception.Handler where
-  handler = handlerIO
-
-instance Handleable SomeException m (CatchIO.Handler m) where
-  handler = handlerCatchIO
-
-handlerIO :: forall a r. Getting (First a) SomeException a -> (a -> IO r) -> Exception.Handler r
-handlerIO l f = reify (preview l) $ \ (_ :: Proxy s) -> Exception.Handler (\(Handling a :: Handling a s IO) -> f a)
-
-handlerCatchIO :: forall m a r. Getting (First a) SomeException a -> (a -> m r) -> CatchIO.Handler m r
-handlerCatchIO l f = reify (preview l) $ \ (_ :: Proxy s) -> CatchIO.Handler (\(Handling a :: Handling a s m) -> f a)
-
 ------------------------------------------------------------------------------
 -- Helpers
 ------------------------------------------------------------------------------
@@ -159,21 +147,3 @@ supply = unsafePerformIO $ newIORef 0
 -- | This permits the construction of an \"impossible\" 'Control.Exception.Handler' that matches only if some function does.
 newtype Handling a s (m :: * -> *) = Handling a
 
--- the m parameter exists simply to break the Typeable1 pattern, so we can provide this without overlap.
--- here we simply generate a fresh TypeRep so we'll fail to compare as equal to any other TypeRep.
-instance Typeable (Handling a s m) where
-  typeOf _ = unsafePerformIO $ do
-    i <- atomicModifyIORef supply $ \a -> let a' = a + 1 in a' `seq` (a', a)
-    return $ mkTyConApp (mkTyCon3 "lens" "Control.Lens.Internal.Exception" ("Handling" ++ show i)) []
-  {-# INLINE typeOf #-}
-
--- The @Handling@ wrapper is uninteresting, and should never be thrown, so you won't get much benefit here.
-instance Show (Handling a s m) where
-  showsPrec d _ = showParen (d > 10) $ showString "Handling ..."
-  {-# INLINE showsPrec #-}
-
-instance Reifies s (SomeException -> Maybe a) => Exception (Handling a s m) where
-  toException _ = SomeException HandlingException
-  {-# INLINE toException #-}
-  fromException = fmap Handling . reflect (Proxy :: Proxy s)
-  {-# INLINE fromException #-}
diff --git a/src/Control/Lens/Prism.hs b/src/Control/Lens/Prism.hs
index 45b5cfe..88c7ff9 100644
--- a/src/Control/Lens/Prism.hs
+++ b/src/Control/Lens/Prism.hs
@@ -53,8 +53,6 @@ import Unsafe.Coerce
 import Data.Profunctor.Unsafe
 #endif
 
-{-# ANN module "HLint: ignore Use camelCase" #-}
-
 -- $setup
 -- >>> :set -XNoOverloadedStrings
 -- >>> import Control.Lens
-- 
1.8.5.1