Skip to content

Commit 568c9b6

Browse files
authored
Update to current proto-lens packages. (#258)
1 parent 0f322b2 commit 568c9b6

File tree

21 files changed

+26
-40
lines changed

21 files changed

+26
-40
lines changed

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resolver: lts-14.4
1+
resolver: lts-15.11
22

33
packages:
44
- tensorflow

tensorflow-core-ops/tensorflow-core-ops.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ library
1616
exposed-modules: TensorFlow.GenOps.Core
1717
autogen-modules: TensorFlow.GenOps.Core
1818
build-depends: bytestring
19-
, proto-lens >= 0.4.0 && < 0.6.0
19+
, proto-lens == 0.6.*
2020
, tensorflow == 0.2.*
2121
, base >= 4.7 && < 5
22-
, lens-family
22+
, lens-family == 2.*
2323
, text
2424
default-language: Haskell2010
2525

2626
custom-setup
2727
setup-depends: Cabal
2828
, bytestring
2929
, directory
30-
, proto-lens >= 0.4.0 && < 0.6.0
30+
, proto-lens == 0.6.*
3131
, tensorflow-opgen == 0.2.*
3232
, tensorflow == 0.2.*
3333
, base >= 4.7 && < 5

tensorflow-logging/tensorflow-logging.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ library
2323
, exceptions
2424
, filepath
2525
, hostname
26-
, lens-family
27-
, proto-lens >= 0.4.0 && < 0.6.0
26+
, lens-family == 2.*
27+
, proto-lens == 0.6.*
2828
, resourcet
2929
, stm
3030
, stm-chans

tensorflow-mnist/src/TensorFlow/Examples/MNIST/Parse.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import Control.Monad (when, liftM)
2424
import Data.Binary.Get (Get, runGet, getWord32be, getLazyByteString)
2525
import Data.ByteString.Lazy (toStrict, readFile)
2626
import Data.List.Split (chunksOf)
27-
import Data.Monoid ((<>))
2827
import Data.ProtoLens (Message, decodeMessageOrDie)
2928
import Data.Text (Text)
3029
import Data.Word (Word8, Word32)

tensorflow-mnist/tensorflow-mnist.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ library
2020
exposed-modules: TensorFlow.Examples.MNIST.Parse
2121
, TensorFlow.Examples.MNIST.TrainedGraph
2222
other-modules: Paths_tensorflow_mnist
23-
build-depends: proto-lens >= 0.4.0 && < 0.6.0
23+
build-depends: proto-lens == 0.6.*
2424
, base >= 4.7 && < 5
2525
, binary
2626
, bytestring
2727
, filepath
28-
, lens-family
28+
, lens-family >= 2.0
2929
, containers
3030
, split
3131
, tensorflow-proto == 0.2.*

tensorflow-opgen/src/TensorFlow/OpGen.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ import Proto.Tensorflow.Core.Framework.OpDef_Fields
7272
import Proto.Tensorflow.Core.Framework.Types (DataType(..))
7373
import System.FilePath (takeBaseName)
7474
import TensorFlow.OpGen.ParsedOp
75-
import Data.Semigroup ((<>))
7675
import Text.PrettyPrint.Mainland
7776
( Doc
7877
, (<+>)

tensorflow-opgen/src/TensorFlow/OpGen/ParsedOp.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import Data.Char (toUpper, toLower)
2525
import Data.List (sortBy)
2626
import Data.List.NonEmpty (NonEmpty, nonEmpty)
2727
import Data.Maybe (mapMaybe)
28-
import Data.Monoid ((<>))
2928
import Data.Ord (comparing)
3029
import qualified Data.Set as Set
3130
import Data.Text (Text)

tensorflow-opgen/tensorflow-opgen.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ library
1616
hs-source-dirs: src
1717
exposed-modules: TensorFlow.OpGen.ParsedOp
1818
, TensorFlow.OpGen
19-
build-depends: proto-lens >= 0.4.0 && < 0.6.0
19+
build-depends: proto-lens == 0.6.*
2020
, tensorflow-proto == 0.2.*
2121
, base >= 4.7 && < 5
2222
, bytestring
2323
, containers
2424
, filepath
25-
, lens-family
25+
, lens-family == 2.*
2626
, mainland-pretty
2727
, optparse-applicative
2828
, semigroups

tensorflow-ops/src/TensorFlow/Gradient.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ import Data.ProtoLens.TextFormat (showMessage)
4343
import Data.Set (Set)
4444
import Data.Text (Text)
4545
import Data.Tuple (swap)
46-
import Lens.Family2 (Lens', view, (&), (^.), (.~), (%~))
46+
import Lens.Family2 (Lens', view, (&), (^.), (.~), (%~), under)
4747
import Lens.Family2.State.Strict (uses)
4848
import Lens.Family2.Stock (at, intAt)
49-
import Lens.Family2.Unchecked (lens, iso)
49+
import Lens.Family2.Unchecked (lens, adapter)
5050
import Prelude hiding (sum, tanh)
5151
import Text.Printf (printf)
5252
import qualified Data.Graph.Inductive.Basic as FGL
@@ -244,7 +244,7 @@ _ `safeIndex` n | n < 0 = Nothing
244244

245245
-- Copy of http://hackage.haskell.org/package/lens-3.9.0.2/docs/Control-Lens-Iso.html#v%3anon
246246
anon :: a -> (a -> Bool) -> Lens' (Maybe a) a
247-
anon a p = iso (fromMaybe a) go where
247+
anon a p = under (adapter (fromMaybe a) go) where
248248
go b | p b = Nothing
249249
| otherwise = Just b
250250

tensorflow-ops/src/TensorFlow/Variable.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
{-# LANGUAGE RecursiveDo #-}
1212
{-# LANGUAGE ScopedTypeVariables #-}
1313
{-# LANGUAGE OverloadedStrings #-}
14-
{-# LANGUAGE NoMonadFailDesugaring #-}
1514
module TensorFlow.Variable
1615
( Variable
1716
, variable

tensorflow-ops/tensorflow-ops.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ library
2121
, TensorFlow.NN
2222
, TensorFlow.Queue
2323
, TensorFlow.Variable
24-
build-depends: proto-lens >= 0.4.0 && < 0.6.0
24+
build-depends: proto-lens == 0.6.*
2525
, base >= 4.7 && < 5
2626
, bytestring
2727
, fgl
2828
, mtl
2929
, data-default
30-
, lens-family
30+
, lens-family == 2.*
3131
, containers
3232
, tensorflow == 0.2.*
3333
, tensorflow-proto == 0.2.*

tensorflow-ops/tests/EmbeddingOpsTest.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
{-# LANGUAGE FlexibleContexts #-}
1616
{-# LANGUAGE RankNTypes #-}
1717
{-# LANGUAGE ScopedTypeVariables #-}
18-
{-# LANGUAGE NoMonadFailDesugaring #-}
1918

2019
-- | Tests for EmbeddingOps.
2120
module Main where

tensorflow-ops/tests/GradientTest.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
{-# LANGUAGE NoMonomorphismRestriction #-}
1717
{-# LANGUAGE ScopedTypeVariables #-}
1818
{-# LANGUAGE FlexibleContexts #-}
19-
{-# LANGUAGE NoMonadFailDesugaring #-}
2019

2120
import Data.Int (Int32, Int64)
2221
import Data.List (sort)
@@ -33,7 +32,7 @@ import Control.Monad(forM_, replicateM, zipWithM)
3332
import Control.Monad.IO.Class (liftIO)
3433

3534
import qualified TensorFlow.Core as TF
36-
import qualified TensorFlow.GenOps.Core as TF (conv2DBackpropInput', max, maximum, resizeBilinear', tile, pad, batchToSpaceND, spaceToBatchND, squeeze, sqrt, slice, shape, diag, depthwiseConv2dNative', depthwiseConv2dNativeBackpropInput', batchMatMul, batchMatMul', sum, conjugateTranspose)
35+
import qualified TensorFlow.GenOps.Core as TF (conv2DBackpropInput', max, maximum, resizeBilinear', tile, pad, batchToSpaceND, spaceToBatchND, squeeze, sqrt, slice, shape, diag, depthwiseConv2dNative', depthwiseConv2dNativeBackpropInput', batchMatMul, batchMatMul', conjugateTranspose)
3736
import qualified TensorFlow.Gradient as TF
3837
import qualified TensorFlow.Ops as TF hiding (zeroInitializedVariable, shape)
3938
import qualified TensorFlow.Output as TF

tensorflow-proto/tensorflow-proto.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ library
176176
, Proto.Tensorflow.Core.Util.SavedTensorSlice_Fields
177177
, Proto.Tensorflow.Core.Util.TestLog
178178
, Proto.Tensorflow.Core.Util.TestLog_Fields
179-
build-depends: proto-lens >= 0.4.0 && < 0.6.0
180-
, proto-lens-runtime >= 0.4.0 && < 0.6.0
181-
, proto-lens-protobuf-types >= 0.4.0 && < 0.6.0
179+
build-depends: proto-lens == 0.6.*
180+
, proto-lens-runtime == 0.6.*
181+
, proto-lens-protobuf-types == 0.6.*
182182
, base >= 4.7 && < 5
183183
default-language: Haskell2010
184184
include-dirs: .

tensorflow-records/tests/Main.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ module Main where
1717

1818
import qualified Data.ByteString as B
1919
import qualified Data.ByteString.Lazy as BL
20-
import Data.Monoid ((<>))
2120
import Data.Word (Word8)
2221
import Data.Serialize (runGet, runPut)
2322
import Test.Framework (Test, defaultMain)

tensorflow/src/TensorFlow/Build.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,10 @@ import Data.ProtoLens.Message(defMessage)
6565
import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask)
6666
import Control.Monad.Fix (MonadFix(..))
6767
import Control.Monad.IO.Class (MonadIO(..))
68-
import Control.Monad.Fail (MonadFail(..))
6968
import Control.Monad.Trans.Class (MonadTrans(..))
7069
import Control.Monad.Trans.State.Strict(StateT(..), mapStateT, evalStateT)
7170
import Data.Functor.Identity (Identity(..))
7271
import qualified Data.Map.Strict as Map
73-
import Data.Monoid ((<>))
7472
import qualified Data.Set as Set
7573
import Data.Set (Set)
7674
import Data.String (IsString(..))

tensorflow/src/TensorFlow/Internal/VarInt.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ module TensorFlow.Internal.VarInt
2828
import Data.Attoparsec.ByteString as Parse
2929
import Data.Bits
3030
import Data.ByteString.Lazy.Builder as Builder
31-
import Data.Monoid ((<>))
3231
import Data.Word (Word64)
3332

3433
-- | Decode an unsigned varint.

tensorflow/src/TensorFlow/Nodes.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module TensorFlow.Nodes where
2626
import Control.Applicative (liftA2, liftA3)
2727
import Data.Functor.Identity (Identity)
2828
import Data.Map.Strict (Map)
29-
import Data.Monoid ((<>))
3029
import Data.Set (Set)
3130
import Data.Text (Text)
3231
import qualified Data.Map.Strict as Map

tensorflow/src/TensorFlow/Session.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,12 @@ module TensorFlow.Session (
3939

4040
import Data.ProtoLens.Message(defMessage)
4141
import Control.Monad (forever, unless, void)
42-
import Control.Monad.Fail (MonadFail(..))
4342
import Control.Monad.Catch (MonadThrow, MonadCatch, MonadMask)
4443
import Control.Monad.IO.Class (MonadIO, liftIO)
4544
import Control.Monad.Trans.Class (MonadTrans, lift)
4645
import Control.Monad.Trans.Reader (ReaderT(..), ask, asks)
4746
import Data.ByteString (ByteString)
4847
import Data.Default (Default, def)
49-
import Data.Monoid ((<>))
5048
import Data.ProtoLens (showMessage)
5149
import Data.Set (Set)
5250
import Data.Text.Encoding (encodeUtf8)

tensorflow/src/TensorFlow/Types.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,14 @@ import Data.Functor.Identity (Identity(..))
6969
import Data.Complex (Complex)
7070
import Data.Int (Int8, Int16, Int32, Int64)
7171
import Data.Maybe (fromMaybe)
72-
import Data.Monoid ((<>))
7372
import Data.ProtoLens.TextFormat (showMessageShort)
7473
import Data.Proxy (Proxy(..))
7574
import Data.String (IsString)
7675
import Data.Word (Word8, Word16, Word32, Word64)
7776
import Foreign.Storable (Storable)
7877
import GHC.Exts (Constraint, IsList(..))
79-
import Lens.Family2 (Lens', view, (&), (.~), (^..))
80-
import Lens.Family2.Unchecked (iso)
78+
import Lens.Family2 (Lens', view, (&), (.~), (^..), under)
79+
import Lens.Family2.Unchecked (adapter)
8180
import Text.Printf (printf)
8281
import qualified Data.Attoparsec.ByteString as Atto
8382
import Data.ByteString (ByteString)
@@ -164,7 +163,7 @@ instance TensorType Int64 where
164163
tensorVal = int64Val
165164

166165
integral :: Integral a => Lens' [Int32] [a]
167-
integral = iso (fmap fromIntegral) (fmap fromIntegral)
166+
integral = under (adapter (fmap fromIntegral) (fmap fromIntegral))
168167

169168
instance TensorType Word8 where
170169
tensorType _ = DT_UINT8
@@ -395,15 +394,15 @@ instance IsList Shape where
395394
toList (Shape ss) = toList ss
396395

397396
protoShape :: Lens' TensorShapeProto Shape
398-
protoShape = iso protoToShape shapeToProto
397+
protoShape = under (adapter protoToShape shapeToProto)
399398
where
400399
protoToShape p = fromMaybe (error msg) (view protoMaybeShape p)
401400
where msg = "Can't convert TensorShapeProto with unknown rank to Shape: "
402401
++ showMessageShort p
403402
shapeToProto s' = defMessage & protoMaybeShape .~ Just s'
404403

405404
protoMaybeShape :: Lens' TensorShapeProto (Maybe Shape)
406-
protoMaybeShape = iso protoToShape shapeToProto
405+
protoMaybeShape = under (adapter protoToShape shapeToProto)
407406
where
408407
protoToShape :: TensorShapeProto -> Maybe Shape
409408
protoToShape p =

tensorflow/tensorflow.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ library
3636
, TensorFlow.Types
3737
other-modules: TensorFlow.Internal.Raw
3838
build-tools: c2hs
39-
build-depends: proto-lens >= 0.4.0 && < 0.6.0
39+
build-depends: proto-lens == 0.6.*
4040
, tensorflow-proto == 0.2.*
4141
, base >= 4.7 && < 5
4242
, async
@@ -46,7 +46,7 @@ library
4646
, data-default
4747
, exceptions
4848
, fgl
49-
, lens-family
49+
, lens-family == 2.*
5050
, mainland-pretty
5151
, mtl
5252
, semigroups

0 commit comments

Comments
 (0)