Safe Haskell | None |
---|---|
Language | GHC2021 |
Ondim.Debug
Synopsis
- data TraceData = TraceData {
- depth :: !Int
- expansionTrace :: ![(Text, DefinitionSite)]
- currentSite :: !DefinitionSite
- inhibitErrors :: !Bool
- data ExceptionType
- data OndimException = OndimException !ExceptionType !TraceData
- data OndimFailure
- withoutNBErrors :: Ondim s a -> Ondim s a
- withNBErrors :: Ondim s a -> Ondim s a
- throwTemplateError :: HasCallStack => Text -> Ondim s a
- throwException :: ExceptionType -> Ondim s a
- catchException :: Ondim s a -> (OndimException -> Ondim s a) -> Ondim s a
- throwExpFailure :: forall {k} (t :: k) s a. Typeable t => Text -> OndimFailure -> Ondim s a
- catchFailure :: Ondim s a -> (OndimFailure -> Text -> SomeTypeRep -> TraceData -> Ondim s a) -> Ondim s a
- data DefinitionSite
- = CodeDefinition !SrcLoc
- | FileDefinition {
- definitionPath :: !FilePath
- definitionExt :: !Text
- | NoDefinition
- getCurrentSite :: Ondim s DefinitionSite
- withSite :: DefinitionSite -> Ondim s a -> Ondim s a
- fileSite :: FilePath -> DefinitionSite
- callStackSite :: DefinitionSite
Debug data
Data used for debugging purposes
Constructors
TraceData | |
Fields
|
data ExceptionType Source #
Constructors
MaxExpansionDepthExceeded | |
TemplateError | Template errors are not meant to be catched from within the templates. Instead, they point at user errors that are supposed to be fixed. |
Failure | Failures are expected in some sense. |
Fields
|
Instances
Exception ExceptionType Source # | |
Defined in Ondim.Internal.Basic Methods toException :: ExceptionType -> SomeException # fromException :: SomeException -> Maybe ExceptionType # displayException :: ExceptionType -> String # backtraceDesired :: ExceptionType -> Bool # | |
Show ExceptionType Source # | |
Defined in Ondim.Internal.Basic Methods showsPrec :: Int -> ExceptionType -> ShowS # show :: ExceptionType -> String # showList :: [ExceptionType] -> ShowS # |
data OndimException Source #
Constructors
OndimException !ExceptionType !TraceData |
Instances
Exception OndimException Source # | |
Defined in Ondim.Internal.Basic Methods toException :: OndimException -> SomeException # fromException :: SomeException -> Maybe OndimException # displayException :: OndimException -> String # backtraceDesired :: OndimException -> Bool # | |
Show OndimException Source # | |
Defined in Ondim.Internal.Basic Methods showsPrec :: Int -> OndimException -> ShowS # show :: OndimException -> String # showList :: [OndimException] -> ShowS # |
data OndimFailure Source #
Failures related to the expansions.
Constructors
NotBound | Identifier is not a bound expansion. |
ExpansionWrongType | Expansion bound under identifier has mismatched type. |
Fields
| |
TemplateWrongType | Expansion bound under identifier has mismatched type. |
Fields
| |
FailureOther !Text | Custom failure. |
Instances
Exception OndimFailure Source # | |
Defined in Ondim.Internal.Basic Methods toException :: OndimFailure -> SomeException # fromException :: SomeException -> Maybe OndimFailure # displayException :: OndimFailure -> String # backtraceDesired :: OndimFailure -> Bool # | |
Show OndimFailure Source # | |
Defined in Ondim.Internal.Basic Methods showsPrec :: Int -> OndimFailure -> ShowS # show :: OndimFailure -> String # showList :: [OndimFailure] -> ShowS # |
Disabling errors
withoutNBErrors :: Ondim s a -> Ondim s a Source #
Run subcomputation without (most) "not bound" errors. More specifically, if
expandNode
finds a node whose identifier is not bound, it will not
throw an error and instead treat it as if it had no identifier, i.e., it will
ignore it and recurse into the substructures.
withNBErrors :: Ondim s a -> Ondim s a Source #
Run subcomputation with "not bound" errors.
Throwing and catching errors
throwTemplateError :: HasCallStack => Text -> Ondim s a Source #
throwException :: ExceptionType -> Ondim s a Source #
catchException :: Ondim s a -> (OndimException -> Ondim s a) -> Ondim s a Source #
throwExpFailure :: forall {k} (t :: k) s a. Typeable t => Text -> OndimFailure -> Ondim s a Source #
catchFailure :: Ondim s a -> (OndimFailure -> Text -> SomeTypeRep -> TraceData -> Ondim s a) -> Ondim s a Source #
Definition sites
data DefinitionSite Source #
Constructors
CodeDefinition !SrcLoc | |
FileDefinition | |
Fields
| |
NoDefinition |
Instances
fileSite :: FilePath -> DefinitionSite Source #