Send Beginners mailing list submissions to
        beginners@haskell.org

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
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  QuickCheck properties on monadic values (Ashish Agarwal)
   2. Re:  QuickCheck properties on monadic values (Rahul Kapoor)
   3. Re:  QuickCheck properties on monadic values
      (Jonas Almstr?m Dureg?rd)


----------------------------------------------------------------------

Message: 1
Date: Fri, 21 May 2010 12:47:30 -0400
From: Ashish Agarwal <agarwal1...@gmail.com>
Subject: [Haskell-beginners] QuickCheck properties on monadic values
To: Haskell-beginners <beginners@haskell.org>
Message-ID:
        <aanlktikc6zkrpbaduq6eka9qfpg42r0tywmr3gqlj...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

I've been using the binary library, and would like to test whether my put
and get functions are inverses. I thought of using QuickCheck but it is not
clear how I can write the necessary property. I skimmed Claessen, Hughes,
"Testing monadic code with QuickCheck", but their examples require a lot of
extra work (e.g. their queue example requires an AST for a mini-queue
language). Am I missing something obvious?

Also, what's the difference between QuickCheck 1 and 2? I'm on gch 6.10 and
doing `cabal install QuickCheck` gives me version 1.2.0.0, which lacks
constructs described in the above paper.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100521/1d24cd31/attachment-0001.html

------------------------------

Message: 2
Date: Fri, 21 May 2010 14:27:45 -0400
From: Rahul Kapoor <rah...@artquiver.com>
Subject: Re: [Haskell-beginners] QuickCheck properties on monadic
        values
To: Ashish Agarwal <agarwal1...@gmail.com>
Cc: Haskell-beginners <beginners@haskell.org>
Message-ID:
        <aanlktil7_uahoisyetj9o35xxyj-b5n_rdmhwgx-j...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Ashish

Test.QuickCheck.Monadic should give you the building blocks you need.

For example here is a snippet which turns a value and a function of
type a -> IO a
into a regular property.

import Test.QuickCheck.Monadic (monadicIO, assert, run, pick)
..
..
propIO :: Show a => Gen a -> (a -> IO Bool) -> Property
propIO gen prop = monadicIO $ do
                    v <- pick gen
                    b <- run $ prop v
                    assert b


You can find some examples of madic quick check properties at:
http://github.com/trie/yay/blob/master/tests/Syck.hs


HTH,
Rahul

On Fri, May 21, 2010 at 12:47 PM, Ashish Agarwal <agarwal1...@gmail.com> wrote:
> I've been using the binary library, and would like to test whether my put
> and get functions are inverses. I thought of using QuickCheck but it is not
> clear how I can write the necessary property. I skimmed Claessen, Hughes,
> "Testing monadic code with QuickCheck", but their examples require a lot of
> extra work (e.g. their queue example requires an AST for a mini-queue
> language). Am I missing something obvious?
> Also, what's the difference between QuickCheck 1 and 2? I'm on gch 6.10 and
> doing `cabal install QuickCheck` gives me version 1.2.0.0, which lacks
> constructs described in the above paper.
> Thanks.
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>


------------------------------

Message: 3
Date: Fri, 21 May 2010 21:52:31 +0200
From: Jonas Almstr?m Dureg?rd <jonas.dureg...@gmail.com>
Subject: Re: [Haskell-beginners] QuickCheck properties on monadic
        values
To: rah...@artquiver.com
Cc: Haskell-beginners <beginners@haskell.org>
Message-ID:
        <aanlktingaytorgj7s6gmpbccmgep0m9s4mjp7ex3o...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Rahul's solution requires QC2, so do cabal install QuickCheck-2.1.0.3.

/Jonas

On 21 May 2010 20:27, Rahul Kapoor <rah...@artquiver.com> wrote:
> Ashish
>
> Test.QuickCheck.Monadic should give you the building blocks you need.
>
> For example here is a snippet which turns a value and a function of
> type a -> IO a
> into a regular property.
>
> import Test.QuickCheck.Monadic (monadicIO, assert, run, pick)
> ..
> ..
> propIO :: Show a => Gen a -> (a -> IO Bool) -> Property
> propIO gen prop = monadicIO $ do
>                    v <- pick gen
>                    b <- run $ prop v
>                    assert b
>
>
> You can find some examples of madic quick check properties at:
> http://github.com/trie/yay/blob/master/tests/Syck.hs
>
>
> HTH,
> Rahul
>
> On Fri, May 21, 2010 at 12:47 PM, Ashish Agarwal <agarwal1...@gmail.com> 
> wrote:
>> I've been using the binary library, and would like to test whether my put
>> and get functions are inverses. I thought of using QuickCheck but it is not
>> clear how I can write the necessary property. I skimmed Claessen, Hughes,
>> "Testing monadic code with QuickCheck", but their examples require a lot of
>> extra work (e.g. their queue example requires an AST for a mini-queue
>> language). Am I missing something obvious?
>> Also, what's the difference between QuickCheck 1 and 2? I'm on gch 6.10 and
>> doing `cabal install QuickCheck` gives me version 1.2.0.0, which lacks
>> constructs described in the above paper.
>> Thanks.
>>
>> _______________________________________________
>> 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
>


------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 23, Issue 34
*****************************************

Reply via email to