rerefined-0.2.0: Refinement types, again
Safe HaskellSafe-Inferred
LanguageGHC2021

Rerefined.Predicate.Common

Description

Handy utilities for defining predicates.

Synopsis

Re-exports

newtype Typeably a #

Wrapper for using with DerivingVia for instances which may be defined using the data type's Typeable instance.

The Typeable version of Generically.

Constructors

Typeably a 

Instances

Instances details
Typeable a => Predicate (Typeably a :: Type) Source #

Fill out predicate metadata using its Typeable instance.

Do not use this for combinator predicates. Doing so will incur insidious Typeable contexts for the wrapped predicate(s).

Instance details

Defined in Rerefined.Predicate

class Typeable (a :: k) #

The class Typeable allows a concrete representation of a type to be calculated.

Minimal complete definition

typeRep#

proxy# :: forall {k} (a :: k). Proxy# a #

Witness for an unboxed Proxy# value, which has no runtime representation.

Predicate validation

validateFail :: forall p. Predicate p => Proxy# p -> String -> [RefineFailure String] -> Maybe (RefineFailure String) Source #

Shortcut for returning a predicate validation failure.

validateBool :: Predicate p => Proxy# p -> String -> Bool -> Maybe (RefineFailure String) Source #

Shortcut for simply validating a Bool.

Predicate name

predicateName1 :: forall p. Predicate p => String -> Int -> ShowS Source #

predicateName2 :: forall l r. (Predicate l, Predicate r) => String -> Int -> ShowS Source #