Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-31 Thread Mario Blažević

On 11-05-30 05:05 AM, Alexey Khudyakov wrote:

On 30.05.2011 12:26, Bas van Dijk wrote:

On 30 May 2011 00:14, Alexey Khudyakov wrote:

It always puzzled me why there are no packages for for testing general
type classes laws. (Monoid laws, monad laws etc). It looks like ideal
case for quickcheck and smallcheck.


How about 'checkers' by Conal Elliott:
http://hackage.haskell.org/package/checkers


We really need better search on hackage than C-f in browser. I didn't
find them. Thank you for pointers.


	When I needed the very same thing a few months ago, I discovered 
checkers by using the reverse dependencies list for QuickCheck:



http://bifunctor.homelinux.net/~roel/cgi-bin/hackage-scripts/revdeps/QuickCheck-2.4.1.1#direct

	That helped a lot, though finding checkers in the list still wasn't a 
breeze.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-30 Thread Alexey Khudyakov

On 30.05.2011 14:45, Henning Thielemann wrote:

Alexey Khudyakov schrieb:

On 30.05.2011 12:26, Bas van Dijk wrote:


How about 'checkers' by Conal Elliott:
http://hackage.haskell.org/package/checkers


We really need better search on hackage than C-f in browser. I didn't
find them. Thank you for pointers.


google with site:hackage.haskell.org option might help

It's do not offer much help. It finds too many pages for module 
descriptions packages get lost here.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-30 Thread Henning Thielemann
Alexey Khudyakov schrieb:
> On 30.05.2011 12:26, Bas van Dijk wrote:
>>
>> How about 'checkers' by Conal Elliott:
>> http://hackage.haskell.org/package/checkers
>>
> We really need better search on hackage than C-f in browser. I didn't
> find them. Thank you for pointers.

google with site:hackage.haskell.org option might help


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-30 Thread Alexey Khudyakov

On 30.05.2011 12:26, Bas van Dijk wrote:

On 30 May 2011 00:14, Alexey Khudyakov  wrote:

It always puzzled me why there are no packages for for testing general
type classes laws. (Monoid laws, monad laws etc). It looks like ideal
case for quickcheck and smallcheck.


How about 'checkers' by Conal Elliott:
http://hackage.haskell.org/package/checkers

We really need better search on hackage than C-f in browser. I didn't 
find them. Thank you for pointers.




Nice work by the way!

Bas



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: quickcheck-properties

2011-05-30 Thread Bas van Dijk
On 30 May 2011 00:14, Alexey Khudyakov  wrote:
> It always puzzled me why there are no packages for for testing general
> type classes laws. (Monoid laws, monad laws etc). It looks like ideal
> case for quickcheck and smallcheck.

How about 'checkers' by Conal Elliott:
http://hackage.haskell.org/package/checkers

Nice work by the way!

Bas

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: quickcheck-properties

2011-05-29 Thread Alexey Khudyakov

Hello

It always puzzled me why there are no packages for for testing general
type classes laws. (Monoid laws, monad laws etc). It looks like ideal
case for quickcheck and smallcheck.

I'm glad to present package quickcheck-properties[1]. It containt set
of generic properties for semiroups, monoids, groups and
unsatisfactory imlementatation of functor's properties. Despite its name
package do not depend on quickcheck and could be used with smallcheck as 
well.


  
Examples
  

Here are few examples:

>>> quickCheck $ eq $ prop_Monoid (T :: T [Int])
+++ OK, passed 100 tests.
>>> quickCheck $ eq $ prop_Monoid (T :: T (Maybe [Int]))
+++ OK, passed 100 tests.


prop_Monoid tests all monoid properties: associativity, left and right
identity. T is used to fix type of monoid to test. It could be done
with type signature for prop_Monoid but writing signature for three
parameter function is just too cumbersome.

eq compares expression in properties using == operator. Many (most?)
of properties have form
> expression = another expression

Easiest solution is to compare them with ==. But is's not
satisfactory. Data type may not have Eq instance. Eq instance may
provide structural equality but some form of equivalince is
needed. etc. It's left to library user to decide how to compare
values.

In this contrived example lists are compared by length.
> eqOn length $ prop_Monoid (T :: T [Int])

  
Problems
  

There are unsolved problems. So it's announcement with
question. Functor/Applicative/Monads laws involve arbitrary functions.
It would be natural to generate them using quickcheck but I don't know
how to generate random functions. Any suggestions?

[1] http://hackage.haskell.org/package/quickcheck-properties


--
  Aleksey Khudyakov

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe