{"action":"created","issue":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/525","labels_url":"https://api.github.com/repos/commercialhaskell/stack/issues/525/labels{/name}","comments_url":"https://api.github.com/repos/commercialhaskell/stack/issues/525/comments","events_url":"https://api.github.com/repos/commercialhaskell/stack/issues/525/events","html_url":"https://github.com/commercialhaskell/stack/issues/525","id":93296423,"number":525,"title":"'stack test' not referentially transparent","user":{"login":"pharpend","id":3221699,"avatar_url":"https://avatars.githubusercontent.com/u/3221699?v=3","gravatar_id":"","url":"https://api.github.com/users/pharpend","html_url":"https://github.com/pharpend","followers_url":"https://api.github.com/users/pharpend/followers","following_url":"https://api.github.com/users/pharpend/following{/other_user}","gists_url":"https://api.github.com/users/pharpend/gists{/gist_id}","starred_url":"https://api.github.com/users/pharpend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pharpend/subscriptions","organizations_url":"https://api.github.com/users/pharpend/orgs","repos_url":"https://api.github.com/users/pharpend/repos","events_url":"https://api.github.com/users/pharpend/events{/privacy}","received_events_url":"https://api.github.com/users/pharpend/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-06T14:45:19Z","updated_at":"2015-07-06T16:30:21Z","closed_at":"2015-07-06T16:30:21Z","body":"**Edit**: By the way, I have the latest git version of stack, as of 8:50 AM MDT, 2015-07-06.\r\n\r\nFull tree: <https://github.com/pharpend/comarkdown>.\r\n\r\nHere is my lovely test suite, with some compiler errors:\r\n\r\n```haskell\r\n{-# LANGUAGE OverloadedLists #-}\r\n{-# LANGUAGE OverloadedStrings #-}\r\n{-# LANGUAGE Trustworthy #-}\r\n\r\n-- This program is free software: you can redistribute it and/or modify\r\n-- it under the terms of the GNU General Public License as published by\r\n-- the Free Software Foundation, either version 3 of the License, or (at\r\n-- your option) any later version.\r\n-- \r\n-- This program is distributed in the hope that it will be useful, but\r\n-- WITHOUT ANY WARRANTY; without even the implied warranty of\r\n-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n-- General Public License for more details.\r\n-- \r\n-- You should have received a copy of the GNU General Public License\r\n-- along with this program.  If not, see <http://www.gnu.org/licenses/>.\r\n\r\n-- | \r\n-- Module      : Main\r\n-- Description : The test suite for comarkdown\r\n-- Copyright   : Copyright 2015 Peter Harpending.\r\n-- License     : GPL-3\r\n-- Maintainer  : peter@harpending.org\r\n-- Stability   : experimental\r\n-- Portability : portable\r\n\r\nmodule Main where\r\n\r\nimport Data.ByteString.Lazy.Char8 (ByteString)\r\nimport qualified Data.ByteString.Lazy.Char8 as B\r\nimport Text.Comarkdown\r\nimport Test.Hspec\r\nimport Test.QuickCheck\r\n\r\nmain :: IO ()\r\nmain = hspec $ context \"Parsing\" $ context \"Recognizing bare headers\" $ header1Tests\r\n\r\nheader1Tests :: Spec\r\nheader1Tests = context \"Header1\" $ parallel $ do\r\n  runParseTest \"'# something' should be an h1\" \"# something\" $\r\n    (Right [Markdown (Header1 \"something\")])\r\n  runParseTest \"'something\\\\n====' should be an h1\" \"something\\n====\"\r\n    (Right [Markdown (Header1 \"something\")])\r\n  runParseTest \"'something\\\\n====' should be an h1\" \"something\\n====\"\r\n    (Right [Markdown (Header1 \"something\")])\r\n  runParseTest \"'something\\\\n=' should be an H1\" \"something\\n=\"\r\n    (Right [Markdown (Header1 \"something\")])\r\n  runParseTest\r\n    \"'# something\\\\n====' should be an h1 with the '='s as part of the header\"\r\n    \"# something\\n====\"\r\n    (Right [Markdown (Header1 \"something ====\")])\r\n  runParseTest \"'# something #' should be an h1\" \"# something #\"\r\n    (Right [Markdown (Header1 \"something\")])\r\n  runParseTest \"'# something ####' should be an h1\" \"# something ####\"\r\n    (Right [Markdown (Header1 \"something\")])\r\n  specify \"'# something' with trailing spaces should be an h1\" $\r\n    property $\r\n      \\(Nat i) -> do\r\n        let s = mappend \"# something\" (replicate i ' ')\r\n        parseResult <- runIO $ parse \"test\" (B.pack s)\r\n        parseResult `shouldBe` Right [Markdown (Header1 \"something\")]\r\n  specify \"'# something #' with trailing spaces should be an h1\" $\r\n    property $\r\n      \\(Nat i) -> do\r\n        let s = mappend \"# something #\" (replicate i ' ')\r\n        parseResult <- runIO $ parse \"test\" (B.pack s)\r\n        parseResult `shouldBe` Right [Markdown (Header1 \"something\")]\r\n  specify \"'# something ' with trailing '#'s should be an h1\" $\r\n    property $\r\n      \\(Nat i) -> do\r\n        let s = mappend \"# something \" (replicate i '#')\r\n        parseResult <- runIO $ parse \"test\" (B.pack s)\r\n        parseResult `shouldBe` Right [Markdown (Header1 \"something\")]\r\n  specify\r\n    \"'# something ' with trailing spaces, trailing '#'s, and more trailing spaces should be an h1\" $\r\n    property $\r\n      \\((Nat i, Nat j, Nat k)) -> do\r\n        let s = mconcat [\"# something \", replicate i ' ', replicate j '#', replicate k ' ']\r\n        parseResult <- runIO $ parse \"test\" (B.pack s)\r\n        parseResult `shouldBe` Right [Markdown (Header1 \"something\")]\r\n\r\nrunParseTest :: String -> ByteString -> Either String Document -> Spec\r\nrunParseTest spec bs supposedResult = it spec $ do\r\n  res <- runIO $ parse \"test input\" bs\r\n  res `shouldBe` supposedResult\r\n\r\nnewtype Nat = Nat {unNat :: Int}\r\n\r\ninstance Arbitrary Nat where\r\n  arbitrary = Nat <$> (suchThat arbitrary (>= 0))\r\n```\r\n\r\nIf I try to pipe the result of `stack test` to a pastebin, this is what shows up on the pastebin:\r\n\r\n```\r\ncomarkdown-0.1.0.0: test (suite: spec)\r\n\r\nParsing\r\n  Recognizing bare headers\r\n    Header1\r\n      '# something' should be an h1 FAILED [1]\r\n      'something\\n====' should be an h1 FAILED [2]\r\n      'something\\n====' should be an h1 FAILED [3]\r\n      'something\\n=' should be an H1 FAILED [4]\r\n      '# something\\n====' should be an h1 with the '='s as part of the header FAILED [5]\r\n      '# something #' should be an h1 FAILED [6]\r\n      '# something ####' should be an h1 FAILED [7]\r\n      '# something' with trailing spaces should be an h1 FAILED [8]\r\n\r\nFailures:\r\n\r\n  1) Parsing, Recognizing bare headers, Header1, '# something' should be an h1\r\n       uncaught exception: ErrorCall (Prelude.undefined)\r\n\r\n  2) Parsing, Recognizing bare headers, Header1, 'something\\n====' should be an h1\r\n       uncaught exception: ErrorCall (Prelude.undefined)\r\n\r\n  3) Parsing, Recognizing bare headers, Header1, 'something\\n====' should be an h1\r\n       uncaught exception: ErrorCall (Prelude.undefined)\r\n\r\n  4) Parsing, Recognizing bare headers, Header1, 'something\\n=' should be an H1\r\n       uncaught exception: ErrorCall (Prelude.undefined)\r\n\r\n  5) Parsing, Recognizing bare headers, Header1, '# something\\n====' should be an h1 with the '='s as part of the header\r\n       uncaught exception: ErrorCall (Prelude.undefined)\r\n\r\n  6) Parsing, Recognizing bare headers, Header1, '# something #' should be an h1\r\n       uncaught exception: ErrorCall (Prelude.undefined)\r\n\r\n  7) Parsing, Recognizing bare headers, Header1, '# something ####' should be an h1\r\n       uncaught exception: ErrorCall (Prelude.undefined)\r\n\r\n  8) Parsing, Recognizing bare headers, Header1, '# something' with trailing spaces should be an h1\r\n       uncaught exception: ErrorCall (Prelude.undefined)\r\n\r\nRandomized with seed 872476737\r\n\r\nFinished in 0.0006 seconds\r\n8 examples, 8 failures\r\nTest suite failure for package comarkdown-0.1.0.0\r\n    spec:  exited with: ExitFailure 1\r\nLogs printed to console\r\n\r\n```\r\n\r\nThat is, the output of the last successfully built test suite.\r\n\r\nIf I don't change the test suite, and try to run `stack test` again, I get the same output.\r\n\r\nHowever, before attempting to pipe the output of `stack test` to a pastebin, the output was this:\r\n\r\n```\r\ncomarkdown-0.1.0.0: build (test)\r\nPreprocessing library comarkdown-0.1.0.0...\r\nIn-place registering comarkdown-0.1.0.0...\r\nPreprocessing test suite 'spec' for comarkdown-0.1.0.0...\r\n[1 of 1] Compiling Main             ( spec/Spec.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.2.0/build/spec/spec-tmp/Main.o )\r\n\r\nspec/Spec.hs:61:9:\r\n    Couldn't match type ‘IO’\r\n                   with ‘hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM a1’\r\n    Expected type: hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM\r\n                     a1 ()\r\n      Actual type: Expectation\r\n    In a stmt of a 'do' block:\r\n      parseResult `shouldBe` Right [Markdown (Header1 \"something\")]\r\n    In the expression:\r\n      do { let s = mappend \"# something\" (replicate i ' ');\r\n           parseResult <- runIO $ parse \"test\" (B.pack s);\r\n           parseResult `shouldBe` Right [Markdown (Header1 \"something\")] }\r\n    In the second argument of ‘($)’, namely\r\n      ‘\\ (Nat i)\r\n         -> do { let ...;\r\n                 parseResult <- runIO $ parse \"test\" (B.pack s);\r\n                 .... }’\r\n\r\nspec/Spec.hs:67:9:\r\n    Couldn't match type ‘IO’\r\n                   with ‘hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM a2’\r\n    Expected type: hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM\r\n                     a2 ()\r\n      Actual type: Expectation\r\n    In a stmt of a 'do' block:\r\n      parseResult `shouldBe` Right [Markdown (Header1 \"something\")]\r\n    In the expression:\r\n      do { let s = mappend \"# something #\" (replicate i ' ');\r\n           parseResult <- runIO $ parse \"test\" (B.pack s);\r\n           parseResult `shouldBe` Right [Markdown (Header1 \"something\")] }\r\n    In the second argument of ‘($)’, namely\r\n      ‘\\ (Nat i)\r\n         -> do { let ...;\r\n                 parseResult <- runIO $ parse \"test\" (B.pack s);\r\n                 .... }’\r\n\r\nspec/Spec.hs:73:9:\r\n    Couldn't match type ‘IO’\r\n                   with ‘hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM a3’\r\n    Expected type: hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM\r\n                     a3 ()\r\n      Actual type: Expectation\r\n    In a stmt of a 'do' block:\r\n      parseResult `shouldBe` Right [Markdown (Header1 \"something\")]\r\n    In the expression:\r\n      do { let s = mappend \"# something \" (replicate i '#');\r\n           parseResult <- runIO $ parse \"test\" (B.pack s);\r\n           parseResult `shouldBe` Right [Markdown (Header1 \"something\")] }\r\n    In the second argument of ‘($)’, namely\r\n      ‘\\ (Nat i)\r\n         -> do { let ...;\r\n                 parseResult <- runIO $ parse \"test\" (B.pack s);\r\n                 .... }’\r\n\r\nspec/Spec.hs:80:9:\r\n    Couldn't match type ‘IO’\r\n                   with ‘hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM a4’\r\n    Expected type: hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM\r\n                     a4 ()\r\n      Actual type: Expectation\r\n    In a stmt of a 'do' block:\r\n      parseResult `shouldBe` Right [Markdown (Header1 \"something\")]\r\n    In the expression:\r\n      do { let s = mconcat ...;\r\n           parseResult <- runIO $ parse \"test\" (B.pack s);\r\n           parseResult `shouldBe` Right [Markdown (Header1 \"something\")] }\r\n    In the second argument of ‘($)’, namely\r\n      ‘\\ ((Nat i, Nat j, Nat k))\r\n         -> do { let ...;\r\n                 parseResult <- runIO $ parse \"test\" (B.pack s);\r\n                 .... }’\r\n\r\nspec/Spec.hs:85:3:\r\n    Couldn't match type ‘IO’\r\n                   with ‘hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM a0’\r\n    Expected type: hspec-core-2.1.7:Test.Hspec.Core.Spec.Monad.SpecM\r\n                     a0 ()\r\n      Actual type: Expectation\r\n    In a stmt of a 'do' block: res `shouldBe` supposedResult\r\n    In the second argument of ‘($)’, namely\r\n      ‘do { res <- runIO $ parse \"test input\" bs;\r\n            res `shouldBe` supposedResult }’\r\n    In the expression:\r\n      it spec\r\n      $ do { res <- runIO $ parse \"test input\" bs;\r\n             res `shouldBe` supposedResult }\r\n\r\n--  While building package comarkdown-0.1.0.0 using:\r\n      /usr/bin/runhaskell -package=Cabal-1.22.2.0 -clear-package-db -global-package-db -package-db=/home/pete/.stack/snapshots/x86_64-linux/nightly-2015-07-03/7.10.1/pkgdb/ /tmp/stack16906/Setup.hs --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.2.0/ build test:spec\r\n    Process exited with code: ExitFailure 1\r\nstack test  2.44s user 1.63s system 163% cpu 2.492 total\r\n```\r\n\r\nIf I make a trivial change to the test suite, and run `stack test` again, I get the compiler-errors output."},"comment":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/comments/118917831","html_url":"https://github.com/commercialhaskell/stack/issues/525#issuecomment-118917831","issue_url":"https://api.github.com/repos/commercialhaskell/stack/issues/525","id":118917831,"user":{"login":"pharpend","id":3221699,"avatar_url":"https://avatars.githubusercontent.com/u/3221699?v=3","gravatar_id":"","url":"https://api.github.com/users/pharpend","html_url":"https://github.com/pharpend","followers_url":"https://api.github.com/users/pharpend/followers","following_url":"https://api.github.com/users/pharpend/following{/other_user}","gists_url":"https://api.github.com/users/pharpend/gists{/gist_id}","starred_url":"https://api.github.com/users/pharpend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pharpend/subscriptions","organizations_url":"https://api.github.com/users/pharpend/orgs","repos_url":"https://api.github.com/users/pharpend/repos","events_url":"https://api.github.com/users/pharpend/events{/privacy}","received_events_url":"https://api.github.com/users/pharpend/received_events","type":"User","site_admin":false},"created_at":"2015-07-06T16:30:20Z","updated_at":"2015-07-06T16:30:20Z","body":"That appears to have fixed it! Thank you, @snoyberg!"}}