-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | An RFC 2119 Monad transformer
@package conformance
@version 0.0.0.0
module Conformance
-- | A conforming monad transformer to compute a result according to a
-- spec.
--
-- RFC 2119 describes these terms:
--
--
-- - MUST and MUST NOT: These describe absolute requirements or
-- absolute prohibitions. However, some implementations still do not
-- adhere to these. Some of those situations are fixable, and some are
-- not.
--
--
-- If the situation is fixable, we error with an error of type
-- ue.
--
-- If the situation is fixable, we can either error out (a strict
-- implementation) with an error of type fe or apply the fix.
-- The fe parameter represents fixable errors, which can either
-- be emitted as warnings, or errored on. A predicate (fe ->
-- Bool) decides whether to fix the error. (The predicate returns
-- True if the fixable error is to be fixed.) 2. SHOULD and SHOULD NOT:
-- These describe weaker requirements or prohibitions. The w
-- parameter represents warnings to represent cases where requirements or
-- prohibitions were violated.
newtype ConformT ue fe w m a
ConformT :: ReaderT (fe -> Bool) (WriterT (Notes fe w) (ExceptT (HaltReason ue fe) m)) a -> ConformT ue fe w m a
[unConformT] :: ConformT ue fe w m a -> ReaderT (fe -> Bool) (WriterT (Notes fe w) (ExceptT (HaltReason ue fe) m)) a
altConform :: Monad m => ConformT ue fe w m a -> ConformT ue fe w m a -> ConformT ue fe w m a
data HaltReason ue fe
HaltedBecauseOfUnfixableError :: !ue -> HaltReason ue fe
HaltedBecauseOfStrictness :: !fe -> HaltReason ue fe
data Notes fe w
Notes :: ![fe] -> ![w] -> Notes fe w
[notesFixableErrors] :: Notes fe w -> ![fe]
[notesWarnings] :: Notes fe w -> ![w]
nullNotes :: Notes w fe -> Bool
-- | Most flexible way to run a ConformT
runConformTFlexible :: (fe -> Bool) -> ConformT ue fe w m a -> m (Either (HaltReason ue fe) (a, Notes fe w))
-- | Don't fix any fixable errors.
--
-- This is standard-compliant.
runConformT :: Monad m => ConformT ue fe w m a -> m (Either (HaltReason ue fe) (a, [w]))
-- | Don't fix any fixable errors, and don't allow any warnings either
--
-- This is standard-compliant, but potentially more strict than
-- necessary.
runConformTStrict :: Monad m => ConformT ue fe w m a -> m (Either (Either ue (Notes fe w)) a)
-- | Fix as much as possible
--
-- That this is not standard-compliant.
runConformTLenient :: Monad m => ConformT ue fe w m a -> m (Either ue (a, Notes fe w))
type Conform ue fe w = ConformT ue fe w Identity
-- | Most flexible way to run a Conform
runConformFlexible :: (fe -> Bool) -> Conform ue fe w a -> Either (HaltReason ue fe) (a, Notes fe w)
-- | Don't fix any fixable errors.
--
-- This is standard-compliant
runConform :: Conform ue fe w a -> Either (HaltReason ue fe) (a, [w])
-- | Don't fix any fixable errors, and don't allow any warnings either
--
-- This is standard-compliant, but potentially more strict than
-- necessary.
runConformStrict :: Conform ue fe w a -> Either (Either ue (Notes fe w)) a
-- | Fix as much as possible
--
-- That this is not standard-compliant.
runConformLenient :: Conform ue fe w a -> Either ue (a, Notes fe w)
-- | Try to run a conform function, return Nothing if there were unfixable
-- errors or unfixed fixable errors.
tryConform :: Monad m => ConformT ue fe w m a -> ConformT ue fe w m (Maybe a)
fixAll :: fe -> Bool
fixNone :: fe -> Bool
conformFromEither :: Monad m => Either ue a -> ConformT ue fe w m a
conformMapAll :: Monad m => (ue1 -> ue2) -> (fe1 -> fe2) -> (w1 -> w2) -> ConformT ue1 fe1 w1 m a -> ConformT ue2 fe2 w2 m a
conformMapErrors :: Monad m => (ue1 -> ue2) -> (fe1 -> fe2) -> ConformT ue1 fe1 w m a -> ConformT ue2 fe2 w m a
conformMapError :: Monad m => (ue1 -> ue2) -> ConformT ue1 fe w m a -> ConformT ue2 fe w m a
conformMapFixableError :: Monad m => (fe1 -> fe2) -> ConformT ue fe1 w m a -> ConformT ue fe2 w m a
emitWarning :: Monad m => w -> ConformT ue fe w m ()
emitFixableError :: Monad m => fe -> ConformT ue fe w m ()
unfixableError :: Monad m => ue -> ConformT ue fe w m a
instance (GHC.Classes.Eq ue, GHC.Classes.Eq fe) => GHC.Classes.Eq (Conformance.HaltReason ue fe)
instance (GHC.Show.Show ue, GHC.Show.Show fe) => GHC.Show.Show (Conformance.HaltReason ue fe)
instance (GHC.Classes.Eq fe, GHC.Classes.Eq w) => GHC.Classes.Eq (Conformance.Notes fe w)
instance (GHC.Show.Show fe, GHC.Show.Show w) => GHC.Show.Show (Conformance.Notes fe w)
instance GHC.Base.Monad m => Control.Monad.Writer.Class.MonadWriter (Conformance.Notes fe w) (Conformance.ConformT ue fe w m)
instance GHC.Base.Monad m => Control.Monad.Error.Class.MonadError (Conformance.HaltReason ue fe) (Conformance.ConformT ue fe w m)
instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader (fe -> GHC.Types.Bool) (Conformance.ConformT ue fe w m)
instance GHC.Base.Monad m => GHC.Base.Monad (Conformance.ConformT ue fe w m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Conformance.ConformT ue fe w m)
instance GHC.Base.Functor m => GHC.Base.Functor (Conformance.ConformT ue fe w m)
instance Control.Monad.Trans.Class.MonadTrans (Conformance.ConformT ue fe w)
instance GHC.Base.Semigroup (Conformance.Notes w fe)
instance GHC.Base.Monoid (Conformance.Notes w fe)
instance (GHC.Exception.Type.Exception ue, GHC.Exception.Type.Exception fe) => GHC.Exception.Type.Exception (Conformance.HaltReason ue fe)