From 719a715e9058a32fcdb1c9cb6f944845843d7c7f Mon Sep 17 00:00:00 2001 From: Christian Berentsen Date: Mon, 3 Apr 2017 14:48:28 +0200 Subject: [PATCH] Adapt to lts-8.6 and use proto-lens-0.2.0.0 --- stack.yaml | 9 +++++---- tensorflow-core-ops/tensorflow-core-ops.cabal | 2 +- tensorflow-logging/tensorflow-logging.cabal | 2 +- tensorflow-logging/tests/LoggingTest.hs | 4 ++-- tensorflow-mnist/tensorflow-mnist.cabal | 2 +- tensorflow-opgen/tensorflow-opgen.cabal | 2 +- tensorflow-ops/tensorflow-ops.cabal | 2 +- tensorflow-proto/tensorflow-proto.cabal | 4 ++-- tensorflow-queue/tensorflow-queue.cabal | 2 +- tensorflow/src/TensorFlow/Session.hs | 4 ++-- tensorflow/src/TensorFlow/Types.hs | 6 +++--- tensorflow/tensorflow.cabal | 4 ++-- 12 files changed, 22 insertions(+), 21 deletions(-) diff --git a/stack.yaml b/stack.yaml index 3421dcc..e323015 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-6.2 +resolver: lts-8.6 packages: - google-shim @@ -18,11 +18,12 @@ packages: extra-deps: # proto-lens is not yet in Stackage. -- proto-lens-0.1.0.5 -- proto-lens-protoc-0.1.0.5 -- proto-lens-descriptors-0.1.0.5 +- proto-lens-0.2.0.0 +- proto-lens-protoc-0.2.0.0 +- proto-lens-descriptors-0.2.0.0 - snappy-framing-0.1.1 - snappy-0.2.0.2 +- lens-labels-0.1.0.0 # Allow our custom Setup.hs scripts to import Data.ProtoLens.Setup from the version of # `proto-lens-protoc` in stack's local DB. See: diff --git a/tensorflow-core-ops/tensorflow-core-ops.cabal b/tensorflow-core-ops/tensorflow-core-ops.cabal index a136b1f..c32d99e 100644 --- a/tensorflow-core-ops/tensorflow-core-ops.cabal +++ b/tensorflow-core-ops/tensorflow-core-ops.cabal @@ -16,7 +16,7 @@ library build-depends: Cabal >= 1.22 && < 1.25 , bytestring , directory - , proto-lens == 0.1.* + , proto-lens == 0.2.* , tensorflow-opgen == 0.1.* , tensorflow == 0.1.* , base >= 4.7 && < 5 diff --git a/tensorflow-logging/tensorflow-logging.cabal b/tensorflow-logging/tensorflow-logging.cabal index 91febd7..2122024 100644 --- a/tensorflow-logging/tensorflow-logging.cabal +++ b/tensorflow-logging/tensorflow-logging.cabal @@ -23,7 +23,7 @@ library , filepath , hostname , lens-family - , proto-lens == 0.1.* + , proto-lens == 0.2.* , resourcet , stm , stm-chans diff --git a/tensorflow-logging/tests/LoggingTest.hs b/tensorflow-logging/tests/LoggingTest.hs index 560d192..12d46d6 100644 --- a/tensorflow-logging/tests/LoggingTest.hs +++ b/tensorflow-logging/tests/LoggingTest.hs @@ -21,7 +21,7 @@ import Data.Default (def) import Data.List ((\\)) import Data.ProtoLens (decodeMessageOrDie) import Lens.Family2 ((^.), (.~), (&)) -import Proto.Tensorflow.Core.Util.Event (fileVersion, step) +import Proto.Tensorflow.Core.Util.Event (Event, fileVersion, step) import System.Directory (getDirectoryContents) import System.FilePath (()) import System.IO.Temp (withSystemTempDirectory) @@ -43,7 +43,7 @@ testEventWriter :: Test testEventWriter = testCase "EventWriter" $ withSystemTempDirectory "event_writer_logs" $ \dir -> do assertEqual "No file before" [] =<< listDirectory dir - let expected = [ def & step .~ 10 + let expected = [ (def :: Event) & step .~ 10 , def & step .~ 222 , def & step .~ 8 ] diff --git a/tensorflow-mnist/tensorflow-mnist.cabal b/tensorflow-mnist/tensorflow-mnist.cabal index 5d406fe..816ea8a 100644 --- a/tensorflow-mnist/tensorflow-mnist.cabal +++ b/tensorflow-mnist/tensorflow-mnist.cabal @@ -19,7 +19,7 @@ library exposed-modules: TensorFlow.Examples.MNIST.Parse , TensorFlow.Examples.MNIST.TrainedGraph other-modules: Paths_tensorflow_mnist - build-depends: proto-lens == 0.1.* + build-depends: proto-lens == 0.2.* , base >= 4.7 && < 5 , binary , bytestring diff --git a/tensorflow-opgen/tensorflow-opgen.cabal b/tensorflow-opgen/tensorflow-opgen.cabal index 39289bd..51169d4 100644 --- a/tensorflow-opgen/tensorflow-opgen.cabal +++ b/tensorflow-opgen/tensorflow-opgen.cabal @@ -15,7 +15,7 @@ library hs-source-dirs: src exposed-modules: TensorFlow.OpGen.ParsedOp , TensorFlow.OpGen - build-depends: proto-lens == 0.1.* + build-depends: proto-lens == 0.2.* , tensorflow-proto == 0.1.* , base >= 4.7 && < 5 , bytestring diff --git a/tensorflow-ops/tensorflow-ops.cabal b/tensorflow-ops/tensorflow-ops.cabal index d5a37bd..e3945f4 100644 --- a/tensorflow-ops/tensorflow-ops.cabal +++ b/tensorflow-ops/tensorflow-ops.cabal @@ -16,7 +16,7 @@ library exposed-modules: TensorFlow.Gradient , TensorFlow.Ops , TensorFlow.EmbeddingOps - build-depends: proto-lens == 0.1.* + build-depends: proto-lens == 0.2.* , base >= 4.7 && < 5 , bytestring , fgl diff --git a/tensorflow-proto/tensorflow-proto.cabal b/tensorflow-proto/tensorflow-proto.cabal index 5f244c4..33836e8 100644 --- a/tensorflow-proto/tensorflow-proto.cabal +++ b/tensorflow-proto/tensorflow-proto.cabal @@ -34,8 +34,8 @@ library , Proto.Tensorflow.Core.Framework.TensorDescription , Proto.Tensorflow.Core.Framework.Versions , Proto.Tensorflow.Core.Protobuf.Debug - build-depends: proto-lens == 0.1.* - , proto-lens-protoc == 0.1.* + build-depends: proto-lens == 0.2.* + , proto-lens-protoc == 0.2.* , base >= 4.7 && < 5 default-language: Haskell2010 include-dirs: . diff --git a/tensorflow-queue/tensorflow-queue.cabal b/tensorflow-queue/tensorflow-queue.cabal index f14f243..708a974 100644 --- a/tensorflow-queue/tensorflow-queue.cabal +++ b/tensorflow-queue/tensorflow-queue.cabal @@ -14,7 +14,7 @@ cabal-version: >=1.22 library hs-source-dirs: src exposed-modules: TensorFlow.Queue - build-depends: proto-lens == 0.1.* + build-depends: proto-lens == 0.2.* , base >= 4.7 && < 5 , bytestring , lens-family diff --git a/tensorflow/src/TensorFlow/Session.hs b/tensorflow/src/TensorFlow/Session.hs index bc24e3d..b62aa38 100644 --- a/tensorflow/src/TensorFlow/Session.hs +++ b/tensorflow/src/TensorFlow/Session.hs @@ -49,7 +49,7 @@ import Data.Set (Set) import Data.Text.Encoding (encodeUtf8) import Lens.Family2 (Lens', (^.), (&), (.~)) import Lens.Family2.Unchecked (lens) -import Proto.Tensorflow.Core.Framework.Graph (node) +import Proto.Tensorflow.Core.Framework.Graph (GraphDef, node) import Proto.Tensorflow.Core.Protobuf.Config (ConfigProto) import TensorFlow.Build import TensorFlow.Nodes @@ -135,7 +135,7 @@ extend = do trace <- Session (asks tracer) nodesToExtend <- build flushNodeBuffer unless (null nodesToExtend) $ liftIO $ do - let graphDef = def & node .~ nodesToExtend + let graphDef = (def :: GraphDef) & node .~ nodesToExtend trace ("Session.extend " <> Builder.string8 (showMessage graphDef)) FFI.extendGraph session graphDef -- Now that all the nodes are created, run the initializers. diff --git a/tensorflow/src/TensorFlow/Types.hs b/tensorflow/src/TensorFlow/Types.hs index b5fd115..f288e8d 100644 --- a/tensorflow/src/TensorFlow/Types.hs +++ b/tensorflow/src/TensorFlow/Types.hs @@ -262,7 +262,7 @@ instance TensorDataType S.Vector Bool where where fromBool x = if x then 1 else 0 :: Word8 -instance {-# OVERLAPPABLE #-} (Storable a, TensorDataType S.Vector a) +instance {-# OVERLAPPABLE #-} (Storable a, TensorDataType S.Vector a, TensorType a) => TensorDataType V.Vector a where decodeTensorData = (S.convert :: S.Vector a -> V.Vector a) . decodeTensorData encodeTensorData x = encodeTensorData x . (S.convert :: V.Vector a -> S.Vector a) @@ -329,7 +329,7 @@ newtype Scalar a = Scalar {unScalar :: a} deriving (Show, Eq, Ord, Num, Fractional, Floating, Real, RealFloat, RealFrac, IsString) -instance TensorDataType V.Vector a => TensorDataType Scalar a where +instance (TensorDataType V.Vector a, TensorType a) => TensorDataType Scalar a where decodeTensorData = Scalar . headFromSingleton . decodeTensorData encodeTensorData x (Scalar y) = encodeTensorData x (V.fromList [y]) @@ -353,7 +353,7 @@ protoShape :: Lens' TensorShapeProto Shape protoShape = iso protoToShape shapeToProto where protoToShape = Shape . fmap (view size) . view dim - shapeToProto (Shape ds) = def & dim .~ fmap (\d -> def & size .~ d) ds + shapeToProto (Shape ds) = (def :: TensorShapeProto) & dim .~ fmap (\d -> def & size .~ d) ds class Attribute a where diff --git a/tensorflow/tensorflow.cabal b/tensorflow/tensorflow.cabal index 0d656f1..1df5a25 100644 --- a/tensorflow/tensorflow.cabal +++ b/tensorflow/tensorflow.cabal @@ -27,9 +27,9 @@ library other-modules: TensorFlow.Internal.Raw , TensorFlow.Orphans build-tools: c2hs - build-depends: proto-lens == 0.1.* + build-depends: proto-lens == 0.2.* -- Used by the custom Setup script (for the test-suite). - , proto-lens-protoc == 0.1.* + , proto-lens-protoc == 0.2.* , tensorflow-proto == 0.1.* , base >= 4.7 && < 5 , async