Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Haskell type Array a b (Kevin Van Horn)
2. Re: Using "cabal test" and getting "cabal: Prelude.read: no
parse" (Erik Price)
3. Re: Haskell type Array a b (Brandon Allbery)
4. Re: Haskell type Array a b (Norbert Melzer)
5. Re: Haskell type Array a b (Brandon Allbery)
----------------------------------------------------------------------
Message: 1
Date: Mon, 26 May 2014 15:12:02 -0600
From: Kevin Van Horn <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Haskell type Array a b
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
I'm looking on the Haskell 98 Report, and the definition of (==) for values of
type Array a b looks wrong to me. Here is the definition given:
a == a' = (assocs a == assocs a')
But this fails to account for the array length in each dimension; hence, if
x is a 0 x 2 array,
y is a 2 x 0, and
z is a 0 x 0 array,
then
x == y
x == z, and
y == z
are all True, even though
bounds x != bounds y,
bounds x != bounds z, and
bounds y != bounds z.
This violates the most fundamental property of equality: that if a == b, then
you can substitute a for b in an expression without changing the value of the
expression.
I can't possibly be the first person to have noticed this. So why is equality
for Arrays defined this way?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140526/ff935013/attachment-0001.html>
------------------------------
Message: 2
Date: Mon, 26 May 2014 17:20:47 -0400
From: Erik Price <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Using "cabal test" and getting
"cabal: Prelude.read: no parse"
Message-ID:
<cad+x7c9fbwcv2vl0hercjfg+g1k9mamzo6tc28czu4fcde6...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
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 <[email protected]> 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 <[email protected] <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
> [email protected] <javascript:;>
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140526/4d3bc9d5/attachment-0001.html>
------------------------------
Message: 3
Date: Mon, 26 May 2014 17:37:49 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Haskell type Array a b
Message-ID:
<cakfcl4vhavgras12zetj0x9e0gvnebwiqqv9w4i_f4qexvh...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Mon, May 26, 2014 at 5:12 PM, Kevin Van Horn <[email protected]> wrote:
> I'm looking on the Haskell 98 Report, and the definition of (==) for
> values of type Array a b looks wrong to me. Here is the definition given:
>
> a == a' = (assocs a == assocs a')
>
> But this fails to account for the array length in each dimension; hence, if
>
Have you tested this? assocs produces a list whose length depends on the
array bounds; (==) on lists accounts for the length. What's left is the
possibility of bounds mismatches, but in that case the index elements of
the list of pairs produced by assocs will not match and they will compare
unequal.
--
brandon s allbery kf8nh sine nomine associates
[email protected] [email protected]
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140526/ed8aae4d/attachment-0001.html>
------------------------------
Message: 4
Date: Tue, 27 May 2014 01:01:31 +0200
From: Norbert Melzer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Haskell type Array a b
Message-ID:
<ca+bcvsui_nrqrn9qkznypnihw5pazmogrwy8vvp-wu9mcry...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
The arrays he gave as an example had all At least one dimension equal to 0.
So assocs would produce an empty list as far as I remember, so the three
arrays would be considered to be equal indeed. It's a pity I can't check
that right now, I'm on mobile...
Am 26.05.2014 23:37 schrieb "Brandon Allbery" <[email protected]>:
> On Mon, May 26, 2014 at 5:12 PM, Kevin Van Horn <[email protected]>wrote:
>
>> I'm looking on the Haskell 98 Report, and the definition of (==) for
>> values of type Array a b looks wrong to me. Here is the definition given:
>>
>> a == a' = (assocs a == assocs a')
>>
>> But this fails to account for the array length in each dimension; hence,
>> if
>>
>
> Have you tested this? assocs produces a list whose length depends on the
> array bounds; (==) on lists accounts for the length. What's left is the
> possibility of bounds mismatches, but in that case the index elements of
> the list of pairs produced by assocs will not match and they will compare
> unequal.
>
> --
> brandon s allbery kf8nh sine nomine
> associates
> [email protected]
> [email protected]
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140527/7ced2206/attachment-0001.html>
------------------------------
Message: 5
Date: Mon, 26 May 2014 19:17:43 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Haskell type Array a b
Message-ID:
<cakfcl4uyg2rznnjdadnqikdhma9m1kfslz+bih-gmwrg6r4...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Mon, May 26, 2014 at 7:01 PM, Norbert Melzer <[email protected]> wrote:
> The arrays he gave as an example had all At least one dimension equal to
> 0. So assocs would produce an empty list as far as I remember, so the three
> arrays would be considered to be equal indeed. It's a pity I can't check
> that right now, I'm on mobile...
>
Then I would indeed expect them to be trivially equal in H'98. I think if
you're looking for anything more precise, you need to switch to something
that can't be represented in H'98 or even H'2010, namely arrays with the
bounds in the type.
--
brandon s allbery kf8nh sine nomine associates
[email protected] [email protected]
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20140526/ce837d2c/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 71, Issue 32
*****************************************