ogma-language-jsonspec-1.12.0: Ogma: Runtime Monitor translator: JSON Frontend

Safe Haskell | None
Language | Haskell2010

Language.JSONSpec.Parser

Description

Parser for Ogma specs stored in JSON files.

Synopsis

- data JSONFormat = JSONFormat {
  - specInternalVars :: Maybe String
  - specInternalVarId :: String
  - specInternalVarExpr :: String
  - specInternalVarType :: Maybe String
  - specExternalVars :: Maybe String
  - specExternalVarId :: String
  - specExternalVarType :: Maybe String
  - specRequirements :: String
  - specRequirementId :: String
  - specRequirementDesc :: Maybe String
  - specRequirementExpr :: String
  - specRequirementResultType :: Maybe String
  - specRequirementResultExpr :: Maybe String
  }
- data JSONFormatInternal = JSONFormatInternal {
  - jfiInternalVars :: Maybe [JSONPathElement]
  - jfiInternalVarId :: [JSONPathElement]
  - jfiInternalVarExpr :: [JSONPathElement]
  - jfiInternalVarType :: Maybe [JSONPathElement]
  - jfiExternalVars :: Maybe [JSONPathElement]
  - jfiExternalVarId :: [JSONPathElement]
  - jfiExternalVarType :: Maybe [JSONPathElement]
  - jfiRequirements :: [JSONPathElement]
  - jfiRequirementId :: [JSONPathElement]
  - jfiRequirementDesc :: Maybe [JSONPathElement]
  - jfiRequirementExpr :: [JSONPathElement]
  - jfiRequirementResultType :: Maybe [JSONPathElement]
  - jfiRequirementResultExpr :: Maybe [JSONPathElement]
  }
- parseJSONFormat :: JSONFormat -> Either String JSONFormatInternal
- parseJSONSpec :: (String -> IO (Either String a)) -> JSONFormat -> Value -> IO (Either String (Spec a))
- valueToString :: String -> Value -> Either String String
- listToEither :: String -> [a] -> Either String a
- parseJSONPath :: Text -> Either String [JSONPathElement]
- showErrors :: Show a => Either a b -> Either String b
- showErrorsM :: Show a => Maybe (Either a b) -> Either String (Maybe b)
- except :: forall (m :: Type -> Type) e a. Monad m => Either e a -> ExceptT e m a
- maybeEither :: Maybe (Either a b) -> Either a (Maybe b)

# Documentation

data JSONFormat Source #

Constructors

JSONFormat |

Fields

- specInternalVars :: Maybe String
- specInternalVarId :: String
- specInternalVarExpr :: String
- specInternalVarType :: Maybe String
- specExternalVars :: Maybe String
- specExternalVarId :: String
- specExternalVarType :: Maybe String
- specRequirements :: String
- specRequirementId :: String
- specRequirementDesc :: Maybe String
- specRequirementExpr :: String
- specRequirementResultType :: Maybe String
- specRequirementResultExpr :: Maybe String

#### Instances

Instances details

Read JSONFormat Source # |
Instance details Defined in Language.JSONSpec.Parser Methods readsPrec :: Int -> ReadS JSONFormat Source # readList :: ReadS [JSONFormat] Source # readPrec :: ReadPrec JSONFormat Source # readListPrec :: ReadPrec [JSONFormat] Source #

data JSONFormatInternal Source #

Constructors

JSONFormatInternal |

Fields

- jfiInternalVars :: Maybe [JSONPathElement]
- jfiInternalVarId :: [JSONPathElement]
- jfiInternalVarExpr :: [JSONPathElement]
- jfiInternalVarType :: Maybe [JSONPathElement]
- jfiExternalVars :: Maybe [JSONPathElement]
- jfiExternalVarId :: [JSONPathElement]
- jfiExternalVarType :: Maybe [JSONPathElement]
- jfiRequirements :: [JSONPathElement]
- jfiRequirementId :: [JSONPathElement]
- jfiRequirementDesc :: Maybe [JSONPathElement]
- jfiRequirementExpr :: [JSONPathElement]
- jfiRequirementResultType :: Maybe [JSONPathElement]
- jfiRequirementResultExpr :: Maybe [JSONPathElement]

parseJSONFormat :: JSONFormat -> Either String JSONFormatInternal Source #

parseJSONSpec :: (String -> IO (Either String a)) -> JSONFormat -> Value -> IO (Either String (Spec a)) Source #

valueToString :: String -> Value -> Either String String Source #

listToEither :: String -> [a] -> Either String a Source #

parseJSONPath :: Text -> Either String [JSONPathElement] Source #

Parse a JSONPath expression, returning its element components.

showErrors :: Show a => Either a b -> Either String b Source #

showErrorsM :: Show a => Maybe (Either a b) -> Either String (Maybe b) Source #

except :: forall (m :: Type -> Type) e a. Monad m => Either e a -> ExceptT e m a Source #

Wrap an `Either` value in an `ExceptT m` monad.

maybeEither :: Maybe (Either a b) -> Either a (Maybe b) Source #

Swap the order in a Maybe and an Either monad.