Using "cabal test" and getting "cabal: Prelude.read: no parse"

Hi all, I created a cabal project with the attached cabal file. I run: cabal configure --enable-tests cabal build cabal test and then I get the error: cabal: Prelude.read: no parse I'm not sure how to debug this any further. If I execute: ./dist/build/scientific-pl-testsStub/scientific-pl-testsStub with any input I've tried (numbers, array notation, string notation, etc.) and I get that same error. I can post the whole project if that is helpful. Thanks for the debugging tips! The full log is: danking@spock # cabal configure --enable-tests Resolving dependencies... Configuring scientific-pl-0.1.0.0... danking@spock # cabal build Building scientific-pl-0.1.0.0... Preprocessing test suite 'scientific-pl-tests' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/SPLEval.o ) [3 of 3] Compiling Tests ( tests/Tests.hs, dist/build/Tests.o ) In-place registering scientific-pl-tests-0.1.0.0... [1 of 1] Compiling Main ( dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/scientific-pl-testsStub.hs, dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/Main.o ) Linking dist/build/scientific-pl-testsStub/scientific-pl-testsStub ... Preprocessing executable 'scientific-pl' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLEval.o ) [3 of 3] Compiling Main ( Main.hs, dist/build/scientific-pl/scientific-pl-tmp/Main.o ) Linking dist/build/scientific-pl/scientific-pl ... danking@spock # cabal test Running 1 test suites... Test suite scientific-pl-tests: RUNNING... cabal: Prelude.read: no parse 1 danking@spock # -- Dan King

Hello,
Last time I got such an error, it was because I was using 'read' for a
type I had defined myself, deriving Read, but on something that was not
reelated to the type. For instance:
data Foo = Foo deriving (Read, Show)
x :: Foo
x = read "Bar"
Do you use read somwhere?
HTH
Daniel King
Hi all,
I created a cabal project with the attached cabal file. I run:
cabal configure --enable-tests cabal build cabal test
and then I get the error:
cabal: Prelude.read: no parse
I'm not sure how to debug this any further. If I execute:
./dist/build/scientific-pl-testsStub/scientific-pl-testsStub
with any input I've tried (numbers, array notation, string notation, etc.) and I get that same error.
I can post the whole project if that is helpful.
Thanks for the debugging tips!
The full log is:
danking@spock # cabal configure --enable-tests Resolving dependencies... Configuring scientific-pl-0.1.0.0... danking@spock # cabal build Building scientific-pl-0.1.0.0... Preprocessing test suite 'scientific-pl-tests' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/SPLEval.o ) [3 of 3] Compiling Tests ( tests/Tests.hs, dist/build/Tests.o ) In-place registering scientific-pl-tests-0.1.0.0... [1 of 1] Compiling Main ( dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/scientific-pl-testsStub.hs, dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/Main.o ) Linking dist/build/scientific-pl-testsStub/scientific-pl-testsStub ... Preprocessing executable 'scientific-pl' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLEval.o ) [3 of 3] Compiling Main ( Main.hs, dist/build/scientific-pl/scientific-pl-tmp/Main.o ) Linking dist/build/scientific-pl/scientific-pl ... danking@spock # cabal test Running 1 test suites... Test suite scientific-pl-tests: RUNNING... cabal: Prelude.read: no parse 1 danking@spock #
-- Boris Daix

It's possible that you're calling the
read :: Read a => String -> a
function somewhere with a parameter that the function doesn't know how to
parse. I ran into this just today when I called
read "a string" :: String
when what I needed to call was
read "\"a string\"" :: String
e
On Monday, May 26, 2014, Boris
Hello,
Last time I got such an error, it was because I was using 'read' for a type I had defined myself, deriving Read, but on something that was not reelated to the type. For instance:
data Foo = Foo deriving (Read, Show)
x :: Foo x = read "Bar"
Do you use read somwhere?
HTH
Daniel King
javascript:;> writes: Hi all,
I created a cabal project with the attached cabal file. I run:
cabal configure --enable-tests cabal build cabal test
and then I get the error:
cabal: Prelude.read: no parse
I'm not sure how to debug this any further. If I execute:
./dist/build/scientific-pl-testsStub/scientific-pl-testsStub
with any input I've tried (numbers, array notation, string notation, etc.) and I get that same error.
I can post the whole project if that is helpful.
Thanks for the debugging tips!
The full log is:
danking@spock # cabal configure --enable-tests Resolving dependencies... Configuring scientific-pl-0.1.0.0... danking@spock # cabal build Building scientific-pl-0.1.0.0... Preprocessing test suite 'scientific-pl-tests' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/SPLEval.o ) [3 of 3] Compiling Tests ( tests/Tests.hs, dist/build/Tests.o ) In-place registering scientific-pl-tests-0.1.0.0... [1 of 1] Compiling Main (
dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/scientific-pl-testsStub.hs,
dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/Main.o ) Linking dist/build/scientific-pl-testsStub/scientific-pl-testsStub ... Preprocessing executable 'scientific-pl' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLEval.o ) [3 of 3] Compiling Main ( Main.hs, dist/build/scientific-pl/scientific-pl-tmp/Main.o ) Linking dist/build/scientific-pl/scientific-pl ... danking@spock # cabal test Running 1 test suites... Test suite scientific-pl-tests: RUNNING... cabal: Prelude.read: no parse 1 danking@spock #
-- Boris Daix _______________________________________________ Beginners mailing list Beginners@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/beginners

I don't call the `read' function in my source code anywhere. I do
derive `read' instances in my data definitions, but otherwise grep
finds no occurrences.
I'm fairly certain this is a bug in the testing framework, but I don't
know how to debug it further. The cabal compilation process seems to
produce a file at
"dist/build/MY_PACKAGE_NAME-testsStub/MY_PACKAGE_NAME-testsStub-tmp/MY_PACKAGE_NAME-testsStub.hs".
This file contains:
module Main ( main ) where
import Distribution.Simple.Test ( stubMain )
import Tests ( tests )
main :: IO ()
main = stubMain tests
In the parent directory there is an executable,
"dist/build/MY_PACKAGE_NAME-testsStub/MY_PACKAGE_NAME-testsStub" which
appears to be the file which cabal executes when I call "cabal test".
I'm not sure how this executable is created but I suspect it comes
from the file I quoted above.
I'm beginning to suspect that the testing framework is not playing
well with something.
This is my test file: http://lpaste.net/104680
I'm using the detailed-0.9 "type" of test module, because the
detailed-1.0 "type" isn't present on my system. Is this the problem?
They seem to reference detailed-1.0 in this user guide I found for
Cabal: http://www.haskell.org/cabal/release/rc/doc/users-guide/#test-suites
. Though now, seeing the URL, it seems that the user guide might be
for a release candidate version of cabal? I found that page through
googling how to set up a test suite in Cabal.
Can someone point me at a different guide or tutorial? I tried this
(http://www.haskell.org/cabal/users-guide/) guide as well, but it
doesn't give any examples and barely references test suites at all.
On Mon, May 26, 2014 at 5:20 PM, Erik Price
It's possible that you're calling the
read :: Read a => String -> a
function somewhere with a parameter that the function doesn't know how to parse. I ran into this just today when I called
read "a string" :: String
when what I needed to call was
read "\"a string\"" :: String
e
On Monday, May 26, 2014, Boris
wrote: Hello,
Last time I got such an error, it was because I was using 'read' for a type I had defined myself, deriving Read, but on something that was not reelated to the type. For instance:
data Foo = Foo deriving (Read, Show)
x :: Foo x = read "Bar"
Do you use read somwhere?
HTH
Daniel King
writes: Hi all,
I created a cabal project with the attached cabal file. I run:
cabal configure --enable-tests cabal build cabal test
and then I get the error:
cabal: Prelude.read: no parse
I'm not sure how to debug this any further. If I execute:
./dist/build/scientific-pl-testsStub/scientific-pl-testsStub
with any input I've tried (numbers, array notation, string notation, etc.) and I get that same error.
I can post the whole project if that is helpful.
Thanks for the debugging tips!
The full log is:
danking@spock # cabal configure --enable-tests Resolving dependencies... Configuring scientific-pl-0.1.0.0... danking@spock # cabal build Building scientific-pl-0.1.0.0... Preprocessing test suite 'scientific-pl-tests' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/SPLEval.o ) [3 of 3] Compiling Tests ( tests/Tests.hs, dist/build/Tests.o ) In-place registering scientific-pl-tests-0.1.0.0... [1 of 1] Compiling Main (
dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/scientific-pl-testsStub.hs, dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/Main.o ) Linking dist/build/scientific-pl-testsStub/scientific-pl-testsStub ... Preprocessing executable 'scientific-pl' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLEval.o ) [3 of 3] Compiling Main ( Main.hs, dist/build/scientific-pl/scientific-pl-tmp/Main.o ) Linking dist/build/scientific-pl/scientific-pl ... danking@spock # cabal test Running 1 test suites... Test suite scientific-pl-tests: RUNNING... cabal: Prelude.read: no parse 1 danking@spock #
-- Boris Daix _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- Dan King

This seems related, though I don't think it's your problem exactly: https://github.com/haskell/cabal/issues/1366 Apparently a "read: no parse" error can be generated when cabal fails to read a log file for some reason. Can you tell us precisely what versions of cabal and ghc you are using (i.e. the output of ghc --version and cabal --version)? -Brent On Mon, May 26, 2014 at 11:12:00PM -0400, Daniel King wrote:
I don't call the `read' function in my source code anywhere. I do derive `read' instances in my data definitions, but otherwise grep finds no occurrences.
I'm fairly certain this is a bug in the testing framework, but I don't know how to debug it further. The cabal compilation process seems to produce a file at "dist/build/MY_PACKAGE_NAME-testsStub/MY_PACKAGE_NAME-testsStub-tmp/MY_PACKAGE_NAME-testsStub.hs". This file contains:
module Main ( main ) where import Distribution.Simple.Test ( stubMain ) import Tests ( tests ) main :: IO () main = stubMain tests
In the parent directory there is an executable, "dist/build/MY_PACKAGE_NAME-testsStub/MY_PACKAGE_NAME-testsStub" which appears to be the file which cabal executes when I call "cabal test". I'm not sure how this executable is created but I suspect it comes from the file I quoted above.
I'm beginning to suspect that the testing framework is not playing well with something.
This is my test file: http://lpaste.net/104680
I'm using the detailed-0.9 "type" of test module, because the detailed-1.0 "type" isn't present on my system. Is this the problem? They seem to reference detailed-1.0 in this user guide I found for Cabal: http://www.haskell.org/cabal/release/rc/doc/users-guide/#test-suites . Though now, seeing the URL, it seems that the user guide might be for a release candidate version of cabal? I found that page through googling how to set up a test suite in Cabal.
Can someone point me at a different guide or tutorial? I tried this (http://www.haskell.org/cabal/users-guide/) guide as well, but it doesn't give any examples and barely references test suites at all.
On Mon, May 26, 2014 at 5:20 PM, Erik Price
wrote: It's possible that you're calling the
read :: Read a => String -> a
function somewhere with a parameter that the function doesn't know how to parse. I ran into this just today when I called
read "a string" :: String
when what I needed to call was
read "\"a string\"" :: String
e
On Monday, May 26, 2014, Boris
wrote: Hello,
Last time I got such an error, it was because I was using 'read' for a type I had defined myself, deriving Read, but on something that was not reelated to the type. For instance:
data Foo = Foo deriving (Read, Show)
x :: Foo x = read "Bar"
Do you use read somwhere?
HTH
Daniel King
writes: Hi all,
I created a cabal project with the attached cabal file. I run:
cabal configure --enable-tests cabal build cabal test
and then I get the error:
cabal: Prelude.read: no parse
I'm not sure how to debug this any further. If I execute:
./dist/build/scientific-pl-testsStub/scientific-pl-testsStub
with any input I've tried (numbers, array notation, string notation, etc.) and I get that same error.
I can post the whole project if that is helpful.
Thanks for the debugging tips!
The full log is:
danking@spock # cabal configure --enable-tests Resolving dependencies... Configuring scientific-pl-0.1.0.0... danking@spock # cabal build Building scientific-pl-0.1.0.0... Preprocessing test suite 'scientific-pl-tests' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/SPLEval.o ) [3 of 3] Compiling Tests ( tests/Tests.hs, dist/build/Tests.o ) In-place registering scientific-pl-tests-0.1.0.0... [1 of 1] Compiling Main (
dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/scientific-pl-testsStub.hs, dist/build/scientific-pl-testsStub/scientific-pl-testsStub-tmp/Main.o ) Linking dist/build/scientific-pl-testsStub/scientific-pl-testsStub ... Preprocessing executable 'scientific-pl' for scientific-pl-0.1.0.0... [1 of 3] Compiling SPLData ( SPLData.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLData.o ) [2 of 3] Compiling SPLEval ( SPLEval.hs, dist/build/scientific-pl/scientific-pl-tmp/SPLEval.o ) [3 of 3] Compiling Main ( Main.hs, dist/build/scientific-pl/scientific-pl-tmp/Main.o ) Linking dist/build/scientific-pl/scientific-pl ... danking@spock # cabal test Running 1 test suites... Test suite scientific-pl-tests: RUNNING... cabal: Prelude.read: no parse 1 danking@spock #
-- Boris Daix _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- Dan King _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On Tue, May 27, 2014 at 1:45 PM, Brent Yorgey
This seems related, though I don't think it's your problem exactly:
I saw that, realized I didn't change directory at all and wasn't really sure how to proceed. It did help me narrow done the cause to something directly in the test suite though.
Apparently a "read: no parse" error can be generated when cabal fails to read a log file for some reason. Can you tell us precisely what versions of cabal and ghc you are using (i.e. the output of ghc --version and cabal --version)?
Sure thing: 1 danking@spock # cabal --version cabal-install version 1.20.0.2 using version 1.20.0.0 of the Cabal library danking@spock # ghc --version The Glorious Glasgow Haskell Compilation System, version 7.6.3 Upon seeing this version information, I tried changing my build-depends to depend on Cabal 1.20 or greater, but I still get the error. -- Dan King

On Tue, May 27, 2014 at 02:47:51PM -0400, Daniel King wrote:
On Tue, May 27, 2014 at 1:45 PM, Brent Yorgey
wrote: This seems related, though I don't think it's your problem exactly:
I saw that, realized I didn't change directory at all and wasn't really sure how to proceed. It did help me narrow done the cause to something directly in the test suite though.
Apparently a "read: no parse" error can be generated when cabal fails to read a log file for some reason. Can you tell us precisely what versions of cabal and ghc you are using (i.e. the output of ghc --version and cabal --version)?
Sure thing:
1 danking@spock # cabal --version cabal-install version 1.20.0.2 using version 1.20.0.0 of the Cabal library
danking@spock # ghc --version The Glorious Glasgow Haskell Compilation System, version 7.6.3
Upon seeing this version information, I tried changing my build-depends to depend on Cabal 1.20 or greater, but I still get the error.
Hmm, I'm not sure then. The people who know the most about the internals of Cabal likely do not read this list; you may have better luck asking on stackoverflow.com and/or in the #hackage channel on Freenode IRC. -Brent

Hi All, I have another modeling related question. This time is about how to model an interface in haskell. (full code in https://github.com/defigueiredo/interfaces-in-haskell) I have an interface that I want any Stock Exchange to follow. I can think of 3 different ways to do this in Haskell: - write a type class and then instantiate it for 3 different types - use a record and associate the appropriate function to each field - use a module and define the appropriate function in each file These options seem to go from most restrictive to least restrictive. In the sense that in the last solution I can make two functions calls: print $ NYSE.getPendingOrders print $ NASDAQ.getPendingOrders and the getPendingOrders functions don't even need to have exactly the same types between the two modules. I can see how this could be useful sometimes. Using record syntax is more restrictive as the type signatures for the functions have to match, but I am not sure what I get from having a type class here, rather than just the records. Comparing the model declarations, the type class solution has an extra parameter 'a' clobbering up the signatures: model.hs --------------------------------------------------------------------- module Model where import Data.Time.Clock.POSIX -- Units type Volume = Double type Price = Double type OrderID = Int type Timestamp = POSIXTime -- Orders data OrderType = Buy | Sell deriving Show data Order = Order { order::OrderType, price ::Price, volume ::Volume, confirmation :: Maybe (OrderID, Timestamp) } deriving Show ------ All versions identical until here ------ class Exchange a where sellAt :: a -> Price -> Volume -> Order buyAt :: a -> Price -> Volume -> Order getPendingOrders :: a -> Maybe [Order] -- returns [Order] or Nothing if can't get that information cancelOrder :: a -> OrderID -> Order -> Maybe (Either Order Order) -- returns canceled order (right) or -- what was still pending if already executed (left) -- or Nothing, if has no connectivity (or other error). --------------------------------------------------------------------- whereas the record solution is... ------ All versions identical until here ------ data Exchange = Exchange { sellAt :: Price -> Volume -> Order, buyAt :: Price -> Volume -> Order, getPendingOrders :: Maybe [Order] cancelOrder :: OrderID -> Order -> Maybe (Either Order Order), } --------------------------------------------------------------------- instances look pretty similar: where's the type class solution... --------------------------------------------------------------------- module NYSE where import Model data NYSE = NYSE instance Exchange NYSE where sellAt = error "NYSE doesn't sell." getPendingOrders a = Just [Order Buy 50 100 Nothing] buyAt = undefined cancelOrder = undefined --------------------------------------------------------------------- here's the record solution... --------------------------------------------------------------------- module NYSE where import Model nyse = Exchange { sellAt = error "NYSE doesn't sell.", getPendingOrders = Just [Order Buy 50 100 Nothing], buyAt = undefined, cancelOrder = undefined } --------------------------------------------------------------------- So, my questions are: 1) What do I get from making this a type class rather than using records? 2) Is there an even better solution I have overlooked? (full code for 3 different solutions in https://github.com/defigueiredo/interfaces-in-haskell) Thanks! Dimitri

Hi all,
In correspondence with #hackage, I determined the source of the error.
I wasn't using a test framework with the detailed-0.9 "test type", so
when my tests threw errors they killed the process and eventually
produced that Prelude.read error.
On Tue, May 27, 2014 at 3:29 PM, Brent Yorgey
On Tue, May 27, 2014 at 02:47:51PM -0400, Daniel King wrote:
On Tue, May 27, 2014 at 1:45 PM, Brent Yorgey
wrote: This seems related, though I don't think it's your problem exactly:
I saw that, realized I didn't change directory at all and wasn't really sure how to proceed. It did help me narrow done the cause to something directly in the test suite though.
Apparently a "read: no parse" error can be generated when cabal fails to read a log file for some reason. Can you tell us precisely what versions of cabal and ghc you are using (i.e. the output of ghc --version and cabal --version)?
Sure thing:
1 danking@spock # cabal --version cabal-install version 1.20.0.2 using version 1.20.0.0 of the Cabal library
danking@spock # ghc --version The Glorious Glasgow Haskell Compilation System, version 7.6.3
Upon seeing this version information, I tried changing my build-depends to depend on Cabal 1.20 or greater, but I still get the error.
Hmm, I'm not sure then. The people who know the most about the internals of Cabal likely do not read this list; you may have better luck asking on stackoverflow.com and/or in the #hackage channel on Freenode IRC.
-Brent _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- Dan King
participants (5)
-
Boris
-
Brent Yorgey
-
Daniel King
-
Dimitri DeFigueiredo
-
Erik Price