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. Re: latest Haskell Platform build fails (Mateusz Kowalczyk)
2. Re: latest Haskell Platform build fails (Michael L Martin)
3. QuickCheck Crazy (Dimitri DeFigueiredo)
4. Re: QuickCheck Crazy (Kim-Ee Yeoh)
5. Re: QuickCheck Crazy (Dimitri DeFigueiredo)
----------------------------------------------------------------------
Message: 1
Date: Thu, 16 Oct 2014 21:11:07 +0100
From: Mateusz Kowalczyk <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] latest Haskell Platform build fails
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252
On 10/15/2014 06:55 PM, Michael L Martin wrote:
> Hello all,
>
> I am trying to install the latest version of Haskell Platform and am
> having a problem.
>
> I created a new VM and installed Ubuntu 14.04 server and applied the
> latest updates. Also installed packages
> "build-essential" and "zlib1g-dev".
>
> I then downloaded and installed ghc-7.8.3 from
> https://www.haskell.org/ghc/download_ghc_7_8_3#x86_64linux
> and then downloaded and installed cabal 1.20.0.3 from
> http://hackage.haskell.org/package/cabal-install.
>
> After installing cabal, I did a "cabal update" followed by "cabal
> install hscolour".
>
> Then downloaded the latest Haskell Platform tarball
> (haskell-platform-2014.2.0.0-srcdist.tar.gz) and attempted to
> install like this:
>
> ./platform.sh ../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2
>
> This fails like this:
>
> ***
> *** Building hptool
> ***
> Building hptool-0.1...
> Preprocessing executable 'hptool' for hptool-0.1...
> ***
> *** Running hptool
> ***
> # rm (for
> build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4)
> # rm (for build/.markers/rel/build/package/happy-1.19.4/build)
> happy-1.19.4 needs mtl-2.1.3.1
> >>> Building happy-1.19.4
> # cp (for build/.markers/rel/build/package/happy-1.19.4/build)
> # rm (for build/.markers/rel/build/package/happy-1.19.4/build)
> # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build)
> # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build)
> Reading package info from "build/package/mtl-2.1.3.1/inplace.conf" ... done.
> mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1
> Error when running Shake build system:
> * build-all
> * build-product
> * build/product/haskell-platform-2014.2.0.0-unknown-posix-x86_64.tar.gz
> * build/target
> *
> build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4
> * build/.markers/rel/build/package/happy-1.19.4/build
> Development.Shake.command, system command failed
> Command:
> /home/mmartin/Downloads/haskell-platform-2014.2.0.0/build/ghc-bindist/local/bin/ghc-pkg
>
> register --package-db=build/package/happy-1.19.4/package.conf.d
> --verbose=1 build/package/mtl-2.1.3.1/inplace.conf
> Exit code: 1
> Stderr:
> mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1
>
> Any suggestions on how to get past this?
>
> Thanks,
> Michael Martin
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
Merely going from the error message and your steps, it seems to me that
you're *not* meant to install GHC yourself first and that the platform
ships with GHC. I would say try again but without installing GHC and
cabal first.
--
Mateusz K.
------------------------------
Message: 2
Date: Thu, 16 Oct 2014 15:46:15 -0500
From: Michael L Martin <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] latest Haskell Platform build fails
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed
On 10/16/2014 03:11 PM, Mateusz Kowalczyk wrote:
> On 10/15/2014 06:55 PM, Michael L Martin wrote:
>> Hello all,
>>
>> I am trying to install the latest version of Haskell Platform and am
>> having a problem.
>>
>> I created a new VM and installed Ubuntu 14.04 server and applied the
>> latest updates. Also installed packages
>> "build-essential" and "zlib1g-dev".
>>
>> I then downloaded and installed ghc-7.8.3 from
>> https://www.haskell.org/ghc/download_ghc_7_8_3#x86_64linux
>> and then downloaded and installed cabal 1.20.0.3 from
>> http://hackage.haskell.org/package/cabal-install.
>>
>> After installing cabal, I did a "cabal update" followed by "cabal
>> install hscolour".
>>
>> Then downloaded the latest Haskell Platform tarball
>> (haskell-platform-2014.2.0.0-srcdist.tar.gz) and attempted to
>> install like this:
>>
>> ./platform.sh ../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2
>>
>> This fails like this:
>>
>> ***
>> *** Building hptool
>> ***
>> Building hptool-0.1...
>> Preprocessing executable 'hptool' for hptool-0.1...
>> ***
>> *** Running hptool
>> ***
>> # rm (for
>> build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4)
>> # rm (for build/.markers/rel/build/package/happy-1.19.4/build)
>> happy-1.19.4 needs mtl-2.1.3.1
>> >>> Building happy-1.19.4
>> # cp (for build/.markers/rel/build/package/happy-1.19.4/build)
>> # rm (for build/.markers/rel/build/package/happy-1.19.4/build)
>> # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build)
>> # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build)
>> Reading package info from "build/package/mtl-2.1.3.1/inplace.conf" ... done.
>> mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1
>> Error when running Shake build system:
>> * build-all
>> * build-product
>> * build/product/haskell-platform-2014.2.0.0-unknown-posix-x86_64.tar.gz
>> * build/target
>> *
>> build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4
>> * build/.markers/rel/build/package/happy-1.19.4/build
>> Development.Shake.command, system command failed
>> Command:
>> /home/mmartin/Downloads/haskell-platform-2014.2.0.0/build/ghc-bindist/local/bin/ghc-pkg
>> register --package-db=build/package/happy-1.19.4/package.conf.d
>> --verbose=1 build/package/mtl-2.1.3.1/inplace.conf
>> Exit code: 1
>> Stderr:
>> mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1
>>
>> Any suggestions on how to get past this?
>>
>> Thanks,
>> Michael Martin
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
> Merely going from the error message and your steps, it seems to me that
> you're *not* meant to install GHC yourself first and that the platform
> ships with GHC. I would say try again but without installing GHC and
> cabal first.
>
>
Well, that didn't work, either:
mmartin@cloud:~/Downloads/haskell-platform-2014.2.0.0$ ./platform.sh
../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2
./platform.sh: 18: ./platform.sh: cabal: not found
***
*** Building hptool
***
./platform.sh: 29: ./platform.sh: cabal: not found
mmartin@cloud:~/Downloads/haskell-platform-2014.2.0.0$
------------------------------
Message: 3
Date: Thu, 16 Oct 2014 21:55:11 -0600
From: Dimitri DeFigueiredo <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] QuickCheck Crazy
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed
Hello Everyone,
I am trying to do homework #3 of Stephanie Weirich's programming class.
It is about QuickCheck.
http://www.seas.upenn.edu/~cis552/current/hw/hw03/index.html
However, quickCheck is magically coming up with the wrong answer!
I am loading a very simple file (distilled from the homework). Here it is:
~~~~
import Test.QuickCheck
------------------------------------------------------------------------------
prop_const :: Eq a => (a -> a -> a) -> a -> a -> Bool
prop_const const' a b = const' a b == a
const_bug :: a -> b -> b
const_bug _ b = b -- Oops: this returns the *second* argument, not the
first.
--main = quickCheck (prop_const const)
~~~~
Now, I just wanted to check that 'prop_const' holds for the 'const'
function, but fails for 'const_bug'
So, I fired up GHCi, but here's what happens:
econ1gw-131-21-dhcp:week3 dimitri$ ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :l weird-quickcheck.hs
[1 of 1] Compiling Main ( weird-quickcheck.hs, interpreted )
weird-quickcheck.hs:22:1: Warning:
The import of `Test.QuickCheck' is redundant
except perhaps to import instances from `Test.QuickCheck'
To import instances alone, use: import Test.QuickCheck()
Ok, modules loaded: Main.
*Main> const 1 2
1
*Main> const_bug 1 2
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package random-1.0.1.1 ... linking ... done.
Loading package primitive-0.5.0.1 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package tf-random-0.5 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package QuickCheck-2.7.6 ... linking ... done.
2
*Main> :t prop_const
prop_const :: Eq a => (a -> a -> a) -> a -> a -> Bool
*Main> quickCheck (prop_const const)
+++ OK, passed 100 tests.
*Main> quickCheck (prop_const const_bug)
+++ OK, passed 100 tests.
*Main> quickCheck (prop_const const_bug :: Char -> Char -> Bool)
*** Failed! Falsifiable (after 1 test and 2 shrinks):
'a'
'b'
*Main>
This makes no sense to me!
First, I have no idea how quickCheck is able to run any tests at all as
the type of 'const' is:
*Main> :t const
const :: a -> b -> a
In other words, it's a polymorphic type.
Second, why does GHCi load so many files when I try to evaluate 'const_bug'?
Finally and most puzzling, why does quickCheck give out the wrong result
if I don't specify the type when testing 'const_bug'?
That's really scary. It means that quickCheck can easily fool me if I
forget to specify the necessary types.
(GHC complains if I uncommented the '--main' line, so I can only do this
in GHCi.)
I am totally lost here, any pointers would be much appreciated.
Thanks,
Dimitri
------------------------------
Message: 4
Date: Fri, 17 Oct 2014 11:34:16 +0700
From: Kim-Ee Yeoh <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] QuickCheck Crazy
Message-ID:
<CAPY+ZdQ=y-hnicrkr3pugshbs_fado8lfq3-p9brr74hgjm...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Fri, Oct 17, 2014 at 10:55 AM, Dimitri DeFigueiredo <
[email protected]> wrote:
> Finally and most puzzling, why does quickCheck give out the wrong result
> if I don't specify the type when testing 'const_bug'?
Quickcheck properties must be monomorphic. Otherwise defaulting rules set
you up for () and hilarity ensues.
Did you google "quickcheck polymorphic types"?
-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20141017/c3ee2a0d/attachment-0001.html>
------------------------------
Message: 5
Date: Thu, 16 Oct 2014 23:53:49 -0600
From: Dimitri DeFigueiredo <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] QuickCheck Crazy
Message-ID: <[email protected]>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"
Thanks Kim-Ee!
This makes more sense now. It does still seem like very unsafe default
behavior by quickCheck. In other words, quickcheck shouldn't be designed
to let code pass all tests if its user (me) forgets to make a property
monomorphic. In any case, the following two links suggested by your
google search were very useful:
http://www.haskell.org/pipermail/haskell/2009-October/021657.html
and the related paper
http://www.cse.chalmers.se/~bernardy/PolyTest.pdf
Thanks again,
Dimitri
On 16/10/14 22:34, Kim-Ee Yeoh wrote:
>
> On Fri, Oct 17, 2014 at 10:55 AM, Dimitri DeFigueiredo
> <[email protected] <mailto:[email protected]>> wrote:
>
> Finally and most puzzling, why does quickCheck give out the wrong
> result if I don't specify the type when testing 'const_bug'?
>
>
> Quickcheck properties must be monomorphic. Otherwise defaulting rules
> set you up for () and hilarity ensues.
>
> Did you google "quickcheck polymorphic types"?
>
> -- Kim-Ee
>
>
> _______________________________________________
> 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/20141016/c2c9150d/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 76, Issue 9
****************************************