module Rerefined.Predicate
( Refine(validate)
, Refine1(validate1)
, RefineFailure(..)
, Predicate(predicateName)
) where
import GHC.Exts ( Proxy# )
import Data.Typeable ( Typeable, typeRep )
import Data.Typeable.Typeably
import Data.Proxy ( Proxy(Proxy) )
class Predicate p where
predicateName :: Proxy# p -> Int -> ShowS
instance Typeable a => Predicate (Typeably a) where
predicateName :: Proxy# (Typeably a) -> Int -> ShowS
predicateName Proxy# (Typeably a)
_ Int
d = Int -> TypeRep -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
d (Proxy a -> TypeRep
forall {k} (proxy :: k -> Type) (a :: k).
Typeable a =>
proxy a -> TypeRep
typeRep (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @a))
class Predicate p => Refine p a where
validate :: Proxy# p -> a -> Maybe (RefineFailure String)
class Predicate p => Refine1 p f where
validate1 :: Proxy# p -> f a -> Maybe (RefineFailure String)
data RefineFailure a = RefineFailure
{ forall a. RefineFailure a -> a
refineFailurePredicate :: a
, forall a. RefineFailure a -> a
refineFailureDetail :: a
, forall a. RefineFailure a -> [RefineFailure a]
refineFailureInner :: [RefineFailure a]
} deriving stock Int -> RefineFailure a -> ShowS
[RefineFailure a] -> ShowS
RefineFailure a -> String
(Int -> RefineFailure a -> ShowS)
-> (RefineFailure a -> String)
-> ([RefineFailure a] -> ShowS)
-> Show (RefineFailure a)
forall a. Show a => Int -> RefineFailure a -> ShowS
forall a. Show a => [RefineFailure a] -> ShowS
forall a. Show a => RefineFailure a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> RefineFailure a -> ShowS
showsPrec :: Int -> RefineFailure a -> ShowS
$cshow :: forall a. Show a => RefineFailure a -> String
show :: RefineFailure a -> String
$cshowList :: forall a. Show a => [RefineFailure a] -> ShowS
showList :: [RefineFailure a] -> ShowS
Show