| Safe Haskell | None | 
|---|---|
| Language | Haskell98 | 
Test.Feat.Modifiers
Description
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] derivingTypeableinstanceEnumerablea =>Enumerable(C a) whereenumerate=unary$funcurry$ \xs ys -> C (nonEmptyxs) (nonEmptyys)
Alternatively you can put everything in pattern postition:
instanceEnumerablea =>Enumerable(C a) whereenumerate=unary$funcurry$ \(Free(NonEmptyxs,NonEmptyys)) -> C xs ys)
The first approach has the advantage of being usable with a 
 point free style:  \xs -> C (.nonEmpty xs) . nonEmpty 
- newtype NonEmpty a = NonEmpty {- nonEmpty :: [a]
 
- mkNonEmpty :: (a, [a]) -> NonEmpty a
- class (Typeable a, Integral a) => Infinite a
- newtype Nat a = Nat {- nat :: a
 
- newtype NonZero a = NonZero {- nonZero :: a
 
- newtype Unicode = Unicode {}
- unicodes :: [Unicode] -> String
- newtype Printable = Printable {}
- printables :: [Printable] -> String
List modifiers
A type of non empty lists.
Instances
| Show a => Show (NonEmpty a) Source | |
| Enumerable a => Enumerable (NonEmpty a) Source | 
mkNonEmpty :: (a, [a]) -> NonEmpty a Source
Numeric modifiers
class (Typeable a, Integral a) => Infinite a Source
A class of infinite precision integral types. Integer is the principal 
 class member.
A type of (infinite precision) natural numbers such that  nat a >= 0 .
A type of (infinite precision) non-zero integers such that  nonZero a /= 0 .
Character and string modifiers
Any unicode character.
Printable ASCII characters
printables :: [Printable] -> String Source
Smart constructor for printable ASCII strings