HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduletesting-feat-1.1.1.1Haskell2010

Test.Feat.Modifiers

Modifiers for types, i.e. newtype wrappers where the values satisfy some constraint (non-empty, positive etc.). Suggestions on useful types are appreciated.

To apply the modifiers types you can use the record label. For instance:

 data C a = C [a] [a] deriving Typeable
 instance Enumerable a => Enumerable (C a) where
    enumerate = c2 $
      \xs ys -> C (nonEmpty xs) (nonEmpty ys)

Alternatively you can put everything in pattern postition:

 instance Enumerable a => Enumerable (C a) where
    enumerate = unary $ funcurry $
      \(Free (NonEmpty xs,NonEmpty ys)) -> C xs ys)

The first approach has the advantage of being usable with a point free style: \xs -> C (nonEmpty xs) . nonEmpty .

  • 5 types
  • 3 values
newtypenewtype Nat a
#

A type of natural numbers such that nat a >= 0 .

Constructors

Instances4Eq, Ord, Show, Enumerable
  • Eq a => Eq (Nat a)Defined in testing-type-modifiers-0.1.0.1 · Data.Modifiers
  • Ord a => Ord (Nat a)Defined in testing-type-modifiers-0.1.0.1 · Data.Modifiers
  • Show a => Show (Nat a)Defined in testing-type-modifiers-0.1.0.1 · Data.Modifiers
  • Infinite integer => Enumerable (Nat integer)Defined in size-based-0.1.3.2 · Control.Enumerable
newtypenewtype NonZero a
#

A type of non-zero integers such that nonZero a /= 0 .

Constructors

Instances3Eq, Ord, Show
  • Eq a => Eq (NonZero a)Defined in testing-type-modifiers-0.1.0.1 · Data.Modifiers
  • Ord a => Ord (NonZero a)Defined in testing-type-modifiers-0.1.0.1 · Data.Modifiers
  • Show a => Show (NonZero a)Defined in testing-type-modifiers-0.1.0.1 · Data.Modifiers
newtypenewtype Unicode
#

Any unicode character. Should contain all values of the Char type.

Constructors

Instances4Eq, Ord, Show, Enumerable
  • Eq UnicodeDefined in testing-type-modifiers-0.1.0.1 · Data.Modifiers
  • Ord UnicodeDefined in testing-type-modifiers-0.1.0.1 · Data.Modifiers
  • Show UnicodeDefined in testing-type-modifiers-0.1.0.1 · Data.Modifiers
  • Enumerable UnicodeDefined in size-based-0.1.3.2 · Control.Enumerable