[Haskell-cafe] Haskell-Cafe Digest, Vol 138, Issue 30

Stuart Hungerford stuart.hungerford at gmail.com
Thu Feb 19 03:00:10 UTC 2015


On Thu, Feb 19, 2015 at 12:13 PM,  <haskell-cafe-request at haskell.org> wrote:

> From: Tom Ellis <tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>
> To: haskell-cafe at haskell.org
> Subject: Re: [Haskell-cafe] Testing polymorphic properties with
>         QuickCheck

> I'm not quite sure what you're asking specifically, but maybe this will
> help:
>
> {-# LANGUAGE ScopedTypeVariables #-}
>
> monoid_suite :: forall m. (Eq m, Monoid m) => String -> Proxy m -> TestTree
> monoid_suite typename _ = testGroup "monoid" [
>    testProperty ("left additive identity (" ++ typename ++ ")")
>      (prop_left_add_id :: m -> Bool),
>
>    ... <other general monoid properties here>
>    ]
>
> monoid_suite_integer :: TestTree
> monoid_suite_integer = monoid_suite "Integer" (Proxy :: Integer)

Please excuse my ignorance as a relatively new Haskell user but is
there anything special about that "Proxy m" type?

Thanks,

 Stu


More information about the Haskell-Cafe mailing list