From 5b4017e31b6cf855c68a20b466dcd6bd59b39856 Mon Sep 17 00:00:00 2001 From: Judah Jacobson Date: Mon, 21 Nov 2016 22:20:08 -0800 Subject: [PATCH] Fix the build on ghc-8.0.1 (#38). (#40) Two issues: - The definition of `\\` was missing parentheses. It was probably a bug that this used to worked in ghc-7.10. - Set `-fconstraint-solver-iterations=0` to work around https://ghc.haskell.org/trac/ghc/ticket/12175. It looks like we can trigger that bug when defining a significantly complicated op. Specifically, our type shenanigans ("OneOf") along with lens setters (for OpDef) seem to confuse GHC. Still TODO: automate testing of different ghc versions to prevent a regression. --- tensorflow-core-ops/tensorflow-core-ops.cabal | 4 ++++ tensorflow-nn/tensorflow-nn.cabal | 4 ++++ tensorflow-ops/tensorflow-ops.cabal | 9 +++++++++ tensorflow/src/TensorFlow/Types.hs | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tensorflow-core-ops/tensorflow-core-ops.cabal b/tensorflow-core-ops/tensorflow-core-ops.cabal index 5267efa..701bd6b 100644 --- a/tensorflow-core-ops/tensorflow-core-ops.cabal +++ b/tensorflow-core-ops/tensorflow-core-ops.cabal @@ -24,6 +24,10 @@ library , lens-family , text default-language: Haskell2010 + -- Work around https://ghc.haskell.org/trac/ghc/ticket/12175. + if impl(ghc >= 8) { + ghc-options: -fconstraint-solver-iterations=0 + } source-repository head type: git diff --git a/tensorflow-nn/tensorflow-nn.cabal b/tensorflow-nn/tensorflow-nn.cabal index ca51474..5c3ae5b 100644 --- a/tensorflow-nn/tensorflow-nn.cabal +++ b/tensorflow-nn/tensorflow-nn.cabal @@ -19,6 +19,10 @@ library , tensorflow == 0.1.* , tensorflow-ops == 0.1.* default-language: Haskell2010 + -- Work around https://ghc.haskell.org/trac/ghc/ticket/12175. + if impl(ghc >= 8) { + ghc-options: -fconstraint-solver-iterations=0 + } Test-Suite NNTest diff --git a/tensorflow-ops/tensorflow-ops.cabal b/tensorflow-ops/tensorflow-ops.cabal index b6b60ad..cf5716a 100644 --- a/tensorflow-ops/tensorflow-ops.cabal +++ b/tensorflow-ops/tensorflow-ops.cabal @@ -29,6 +29,10 @@ library , tensorflow-core-ops == 0.1.* , text default-language: Haskell2010 + -- Work around https://ghc.haskell.org/trac/ghc/ticket/12175. + if impl(ghc >= 8) { + ghc-options: -fconstraint-solver-iterations=0 + } Test-Suite BuildTest default-language: Haskell2010 @@ -202,6 +206,11 @@ Test-Suite TypesTest , test-framework-hunit , test-framework-quickcheck2 , vector + -- Work around https://ghc.haskell.org/trac/ghc/ticket/12175, + -- since this test defines its own ops. + if impl(ghc >= 8) { + ghc-options: -fconstraint-solver-iterations=0 + } Benchmark FeedFetchBench default-language: Haskell2010 diff --git a/tensorflow/src/TensorFlow/Types.hs b/tensorflow/src/TensorFlow/Types.hs index 3d47f39..2c9c193 100644 --- a/tensorflow/src/TensorFlow/Types.hs +++ b/tensorflow/src/TensorFlow/Types.hs @@ -373,7 +373,7 @@ type family Delete a as where -- | Takes the difference of two lists of types. type family as \\ bs where as \\ '[] = as - as \\ b ': bs = Delete b as \\ bs + as \\ (b ': bs) = Delete b as \\ bs -- | A constraint that the type @a@ doesn't appear in the type list @ts@. -- Assumes that @a@ and each of the elements of @ts@ are 'TensorType's.