Adapt to lts-8.6 and use proto-lens-0.2.0.1 (#97)

This commit is contained in:
Christian Berentsen 2017-04-11 23:09:01 +02:00 committed by Greg Steuck
parent de16a576da
commit 21b723d542
12 changed files with 23 additions and 22 deletions

View File

@ -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.1
- proto-lens-protoc-0.2.0.1
- proto-lens-descriptors-0.2.0.1
- snappy-framing-0.1.1
- snappy-0.2.0.2
- lens-labels-0.1.0.1
# Allow our custom Setup.hs scripts to import Data.ProtoLens.Setup from the version of
# `proto-lens-protoc` in stack's local DB. See:

View File

@ -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

View File

@ -23,7 +23,7 @@ library
, filepath
, hostname
, lens-family
, proto-lens == 0.1.*
, proto-lens == 0.2.*
, resourcet
, stm
, stm-chans

View File

@ -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
]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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: .

View File

@ -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

View File

@ -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.

View File

@ -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
@ -410,7 +410,7 @@ instance All Eq (Map f as) => Eq (ListOf f as) where
(x :/ xs) == (y :/ ys) = x == y && xs == ys
-- Newer versions of GHC use the GADT to tell that the previous cases are
-- exhaustive.
#if _GLASGOW_HASKELL__ < 800
#if __GLASGOW_HASKELL__ < 800
_ == _ = False
#endif

View File

@ -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