Skip to content

less cpp noise in properties using type synonyms #84

@chessai

Description

@chessai

instead of:

prop1 :: forall proxy f.
#if HAVE_QUANTIFIED_CONSTRAINTS
(blah)
#else 
(blah1)
#endif 
  => proxy f -> Property
...

prop1 :: forall proxy f.
#if HAVE_QUANTIFIED_CONSTRAINTS
(blah)
#else 
(blah1)
#endif 
  => proxy f -> Property

we can have, using Bifunctor as an example, the following:

type BifunctorProp f =
  ( Bifunctor f
#if HAVE_QUANTIFIED_CONSTRAINTS
  , forall x y. (Eq x, Eq y) => Eq (f x y)
  , forall x y. (Show x, Show y) => Show (f x y)
  , forall x y. (Arbitrary x, Arbitrary y) => Arbitrary (f x y) 
#else 
  , Eq2 f
  , Show2 f
  , Arbitrary2 f
#endif 
  ) => proxy f -> Property

prop1 :: forall f. BifunctorProp f
prop2 :: forall f. BifunctorProp f
...
prop3million :: forall f. BifunctorProp f

this would help reduce at least some of the noise, and wouldn't be visible externally, since it only affects the internal properties (ie not the user-facing functions of type Proxy a -> Laws)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions