hydra-pg-0.18.0: src/main/haskell/Hydra/Pg/Decode/Model.hs
-- Note: this is an automatically generated file. Do not edit.
-- | Term decoders for hydra.pg.model
module Hydra.Pg.Decode.Model where
import qualified Hydra.Core.Decode.Model as DecodeModel
import qualified Hydra.Core.Errors as Errors
import qualified Hydra.Core.Extract.Model as ExtractModel
import qualified Hydra.Core.Graph as Graph
import qualified Hydra.Core.Lexical as Lexical
import qualified Hydra.Core.Overlay.Haskell.Lib.Eithers as Eithers
import qualified Hydra.Core.Overlay.Haskell.Lib.Maps as Maps
import qualified Hydra.Core.Overlay.Haskell.Lib.Optionals as Optionals
import qualified Hydra.Core.Overlay.Haskell.Lib.Strings as Strings
import qualified Hydra.Core.Model as CoreModel
import qualified Hydra.Core.Rewriting as Rewriting
import qualified Hydra.Core.Util as Util
import qualified Hydra.Pg.Model as PgModel
import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines)
import qualified Data.Scientific as Sci
import Data.Void
-- | Decoder for hydra.pg.model.AdjacentEdge
adjacentEdge :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.AdjacentEdge t0)
adjacentEdge v cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "label" edgeLabel fieldMap cx) (\field_label -> Eithers.bind (ExtractModel.requireField "id" v fieldMap cx) (\field_id -> Eithers.bind (ExtractModel.requireField "vertex" v fieldMap cx) (\field_vertex -> Eithers.bind (ExtractModel.requireField "properties" (ExtractModel.decodeMap propertyKey v) fieldMap cx) (\field_properties -> Right (PgModel.AdjacentEdge {
PgModel.adjacentEdgeLabel = field_label,
PgModel.adjacentEdgeId = field_id,
PgModel.adjacentEdgeVertex = field_vertex,
PgModel.adjacentEdgeProperties = field_properties}))))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.AdjacentEdge")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.Direction
direction :: Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError PgModel.Direction
direction cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermInject v0 ->
let field = CoreModel.injectionField v0
fname = CoreModel.fieldName field
fterm = CoreModel.fieldTerm field
variantMap =
Maps.fromList [
(CoreModel.Name "out", (\input -> Eithers.map (\t -> PgModel.DirectionOut) (ExtractModel.decodeUnit cx input))),
(CoreModel.Name "in", (\input -> Eithers.map (\t -> PgModel.DirectionIn) (ExtractModel.decodeUnit cx input))),
(CoreModel.Name "both", (\input -> Eithers.map (\t -> PgModel.DirectionBoth) (ExtractModel.decodeUnit cx input))),
(
CoreModel.Name "undirected",
(\input -> Eithers.map (\t -> PgModel.DirectionUndirected) (ExtractModel.decodeUnit cx input)))]
in (Optionals.match (Maps.lookup fname variantMap) (Left (Errors.DecodingError (Strings.concat [
"no such field ",
(CoreModel.unName fname),
" in union"]))) (\f -> f fterm))
_ -> Left (Errors.DecodingError "expected union")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.Edge
edge :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.Edge t0)
edge v cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "label" edgeLabel fieldMap cx) (\field_label -> Eithers.bind (ExtractModel.requireField "id" v fieldMap cx) (\field_id -> Eithers.bind (ExtractModel.requireField "out" v fieldMap cx) (\field_out -> Eithers.bind (ExtractModel.requireField "in" v fieldMap cx) (\field_in -> Eithers.bind (ExtractModel.requireField "properties" (ExtractModel.decodeMap propertyKey v) fieldMap cx) (\field_properties -> Right (PgModel.Edge {
PgModel.edgeLabel = field_label,
PgModel.edgeId = field_id,
PgModel.edgeOut = field_out,
PgModel.edgeIn = field_in,
PgModel.edgeProperties = field_properties})))))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.Edge")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.EdgeLabel
edgeLabel :: Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError PgModel.EdgeLabel
edgeLabel cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermWrap v0 -> Eithers.map (\b -> PgModel.EdgeLabel b) ((\raw2 -> Eithers.either (\err -> Left err) (\stripped2 -> case stripped2 of
CoreModel.TermLiteral v1 -> case v1 of
CoreModel.LiteralString v2 -> Right v2
_ -> Left (Errors.DecodingError "expected string literal")
_ -> Left (Errors.DecodingError "expected literal")) (ExtractModel.stripWithDecodingError cx raw2)) (CoreModel.wrappedTermBody v0))
_ -> Left (Errors.DecodingError "expected wrapped type")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.EdgeType
edgeType :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.EdgeType t0)
edgeType t cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "label" edgeLabel fieldMap cx) (\field_label -> Eithers.bind (ExtractModel.requireField "id" t fieldMap cx) (\field_id -> Eithers.bind (ExtractModel.requireField "out" vertexLabel fieldMap cx) (\field_out -> Eithers.bind (ExtractModel.requireField "in" vertexLabel fieldMap cx) (\field_in -> Eithers.bind (ExtractModel.requireField "properties" (ExtractModel.decodeList (propertyType t)) fieldMap cx) (\field_properties -> Right (PgModel.EdgeType {
PgModel.edgeTypeLabel = field_label,
PgModel.edgeTypeId = field_id,
PgModel.edgeTypeOut = field_out,
PgModel.edgeTypeIn = field_in,
PgModel.edgeTypeProperties = field_properties})))))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.EdgeType")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.Element
element :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.Element t0)
element v cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermInject v0 ->
let field = CoreModel.injectionField v0
fname = CoreModel.fieldName field
fterm = CoreModel.fieldTerm field
variantMap =
Maps.fromList [
(CoreModel.Name "vertex", (\input -> Eithers.map (\t -> PgModel.ElementVertex t) (vertex v cx input))),
(CoreModel.Name "edge", (\input -> Eithers.map (\t -> PgModel.ElementEdge t) (edge v cx input)))]
in (Optionals.match (Maps.lookup fname variantMap) (Left (Errors.DecodingError (Strings.concat [
"no such field ",
(CoreModel.unName fname),
" in union"]))) (\f -> f fterm))
_ -> Left (Errors.DecodingError "expected union")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.ElementKind
elementKind :: Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError PgModel.ElementKind
elementKind cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermInject v0 ->
let field = CoreModel.injectionField v0
fname = CoreModel.fieldName field
fterm = CoreModel.fieldTerm field
variantMap =
Maps.fromList [
(CoreModel.Name "vertex", (\input -> Eithers.map (\t -> PgModel.ElementKindVertex) (ExtractModel.decodeUnit cx input))),
(CoreModel.Name "edge", (\input -> Eithers.map (\t -> PgModel.ElementKindEdge) (ExtractModel.decodeUnit cx input)))]
in (Optionals.match (Maps.lookup fname variantMap) (Left (Errors.DecodingError (Strings.concat [
"no such field ",
(CoreModel.unName fname),
" in union"]))) (\f -> f fterm))
_ -> Left (Errors.DecodingError "expected union")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.ElementTree
elementTree :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.ElementTree t0)
elementTree v cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "self" (element v) fieldMap cx) (\field_self -> Eithers.bind (ExtractModel.requireField "dependencies" (ExtractModel.decodeList (elementTree v)) fieldMap cx) (\field_dependencies -> Right (PgModel.ElementTree {
PgModel.elementTreeSelf = field_self,
PgModel.elementTreeDependencies = field_dependencies}))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.ElementTree")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.ElementType
elementType :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.ElementType t0)
elementType t cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermInject v0 ->
let field = CoreModel.injectionField v0
fname = CoreModel.fieldName field
fterm = CoreModel.fieldTerm field
variantMap =
Maps.fromList [
(CoreModel.Name "vertex", (\input -> Eithers.map (\t2 -> PgModel.ElementTypeVertex t2) (vertexType t cx input))),
(CoreModel.Name "edge", (\input -> Eithers.map (\t2 -> PgModel.ElementTypeEdge t2) (edgeType t cx input)))]
in (Optionals.match (Maps.lookup fname variantMap) (Left (Errors.DecodingError (Strings.concat [
"no such field ",
(CoreModel.unName fname),
" in union"]))) (\f -> f fterm))
_ -> Left (Errors.DecodingError "expected union")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.ElementTypeTree
elementTypeTree :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.ElementTypeTree t0)
elementTypeTree t cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "self" (elementType t) fieldMap cx) (\field_self -> Eithers.bind (ExtractModel.requireField "dependencies" (ExtractModel.decodeList (elementTypeTree t)) fieldMap cx) (\field_dependencies -> Right (PgModel.ElementTypeTree {
PgModel.elementTypeTreeSelf = field_self,
PgModel.elementTypeTreeDependencies = field_dependencies}))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.ElementTypeTree")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.Graph
graph :: Ord t0 => ((Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.Graph t0))
graph v cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "vertices" (ExtractModel.decodeMap v (vertex v)) fieldMap cx) (\field_vertices -> Eithers.bind (ExtractModel.requireField "edges" (ExtractModel.decodeMap v (edge v)) fieldMap cx) (\field_edges -> Right (PgModel.Graph {
PgModel.graphVertices = field_vertices,
PgModel.graphEdges = field_edges}))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.Graph")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.GraphSchema
graphSchema :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.GraphSchema t0)
graphSchema t cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "vertices" (ExtractModel.decodeMap vertexLabel (vertexType t)) fieldMap cx) (\field_vertices -> Eithers.bind (ExtractModel.requireField "edges" (ExtractModel.decodeMap edgeLabel (edgeType t)) fieldMap cx) (\field_edges -> Right (PgModel.GraphSchema {
PgModel.graphSchemaVertices = field_vertices,
PgModel.graphSchemaEdges = field_edges}))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.GraphSchema")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.Label
label :: Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError PgModel.Label
label cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermInject v0 ->
let field = CoreModel.injectionField v0
fname = CoreModel.fieldName field
fterm = CoreModel.fieldTerm field
variantMap =
Maps.fromList [
(CoreModel.Name "vertex", (\input -> Eithers.map (\t -> PgModel.LabelVertex t) (vertexLabel cx input))),
(CoreModel.Name "edge", (\input -> Eithers.map (\t -> PgModel.LabelEdge t) (edgeLabel cx input)))]
in (Optionals.match (Maps.lookup fname variantMap) (Left (Errors.DecodingError (Strings.concat [
"no such field ",
(CoreModel.unName fname),
" in union"]))) (\f -> f fterm))
_ -> Left (Errors.DecodingError "expected union")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.LazyGraph
lazyGraph :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.LazyGraph t0)
lazyGraph v cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "vertices" (ExtractModel.decodeList (vertex v)) fieldMap cx) (\field_vertices -> Eithers.bind (ExtractModel.requireField "edges" (ExtractModel.decodeList (edge v)) fieldMap cx) (\field_edges -> Right (PgModel.LazyGraph {
PgModel.lazyGraphVertices = field_vertices,
PgModel.lazyGraphEdges = field_edges}))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.LazyGraph")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.Property
property :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.Property t0)
property v cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "key" propertyKey fieldMap cx) (\field_key -> Eithers.bind (ExtractModel.requireField "value" v fieldMap cx) (\field_value -> Right (PgModel.Property {
PgModel.propertyKey = field_key,
PgModel.propertyValue = field_value}))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.Property")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.PropertyKey
propertyKey :: Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError PgModel.PropertyKey
propertyKey cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermWrap v0 -> Eithers.map (\b -> PgModel.PropertyKey b) ((\raw2 -> Eithers.either (\err -> Left err) (\stripped2 -> case stripped2 of
CoreModel.TermLiteral v1 -> case v1 of
CoreModel.LiteralString v2 -> Right v2
_ -> Left (Errors.DecodingError "expected string literal")
_ -> Left (Errors.DecodingError "expected literal")) (ExtractModel.stripWithDecodingError cx raw2)) (CoreModel.wrappedTermBody v0))
_ -> Left (Errors.DecodingError "expected wrapped type")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.PropertyType
propertyType :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.PropertyType t0)
propertyType t cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "key" propertyKey fieldMap cx) (\field_key -> Eithers.bind (ExtractModel.requireField "value" t fieldMap cx) (\field_value -> Eithers.bind (ExtractModel.requireField "required" (\cx2 -> \raw2 -> Eithers.either (\err -> Left err) (\stripped2 -> case stripped2 of
CoreModel.TermLiteral v1 -> case v1 of
CoreModel.LiteralBoolean v2 -> Right v2
_ -> Left (Errors.DecodingError "expected boolean literal")
_ -> Left (Errors.DecodingError "expected literal")) (ExtractModel.stripWithDecodingError cx2 raw2)) fieldMap cx) (\field_required -> Right (PgModel.PropertyType {
PgModel.propertyTypeKey = field_key,
PgModel.propertyTypeValue = field_value,
PgModel.propertyTypeRequired = field_required})))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.PropertyType")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.Vertex
vertex :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.Vertex t0)
vertex v cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "label" vertexLabel fieldMap cx) (\field_label -> Eithers.bind (ExtractModel.requireField "id" v fieldMap cx) (\field_id -> Eithers.bind (ExtractModel.requireField "properties" (ExtractModel.decodeMap propertyKey v) fieldMap cx) (\field_properties -> Right (PgModel.Vertex {
PgModel.vertexLabel = field_label,
PgModel.vertexId = field_id,
PgModel.vertexProperties = field_properties})))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.Vertex")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.VertexLabel
vertexLabel :: Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError PgModel.VertexLabel
vertexLabel cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermWrap v0 -> Eithers.map (\b -> PgModel.VertexLabel b) ((\raw2 -> Eithers.either (\err -> Left err) (\stripped2 -> case stripped2 of
CoreModel.TermLiteral v1 -> case v1 of
CoreModel.LiteralString v2 -> Right v2
_ -> Left (Errors.DecodingError "expected string literal")
_ -> Left (Errors.DecodingError "expected literal")) (ExtractModel.stripWithDecodingError cx raw2)) (CoreModel.wrappedTermBody v0))
_ -> Left (Errors.DecodingError "expected wrapped type")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.VertexType
vertexType :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.VertexType t0)
vertexType t cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "label" vertexLabel fieldMap cx) (\field_label -> Eithers.bind (ExtractModel.requireField "id" t fieldMap cx) (\field_id -> Eithers.bind (ExtractModel.requireField "properties" (ExtractModel.decodeList (propertyType t)) fieldMap cx) (\field_properties -> Right (PgModel.VertexType {
PgModel.vertexTypeLabel = field_label,
PgModel.vertexTypeId = field_id,
PgModel.vertexTypeProperties = field_properties})))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.VertexType")) (ExtractModel.stripWithDecodingError cx raw)
-- | Decoder for hydra.pg.model.VertexWithAdjacentEdges
vertexWithAdjacentEdges :: (Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError t0) -> Graph.Graph -> CoreModel.Term -> Either Errors.DecodingError (PgModel.VertexWithAdjacentEdges t0)
vertexWithAdjacentEdges v cx raw =
Eithers.either (\err -> Left err) (\stripped -> case stripped of
CoreModel.TermRecord v0 ->
let fieldMap = ExtractModel.toFieldMap v0
in (Eithers.bind (ExtractModel.requireField "vertex" (vertex v) fieldMap cx) (\field_vertex -> Eithers.bind (ExtractModel.requireField "ins" (ExtractModel.decodeList (adjacentEdge v)) fieldMap cx) (\field_ins -> Eithers.bind (ExtractModel.requireField "outs" (ExtractModel.decodeList (adjacentEdge v)) fieldMap cx) (\field_outs -> Right (PgModel.VertexWithAdjacentEdges {
PgModel.vertexWithAdjacentEdgesVertex = field_vertex,
PgModel.vertexWithAdjacentEdgesIns = field_ins,
PgModel.vertexWithAdjacentEdgesOuts = field_outs})))))
_ -> Left (Errors.DecodingError "expected a record of type hydra.pg.model.VertexWithAdjacentEdges")) (ExtractModel.stripWithDecodingError cx raw)