packages feed

hydra-kernel-0.17.6: src/main/haskell/Hydra/Paths.hs

-- Note: this is an automatically generated file. Do not edit.

-- | Subterm and subtype access, and the link view of a graph

module Hydra.Paths where

import qualified Hydra.Core as Core
import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines)
import qualified Data.Scientific as Sci
import Data.Void

-- | A link from a node to a non-term attribute of a position
data SubtermAttribute =
  SubtermAttribute {
    -- | The subterm path at which the attribute occurs
    subtermAttributePath :: SubtermPath,
    -- | The attribute value
    subtermAttributeTarget :: TermAttribute}
  deriving (Eq, Ord, Read, Show)

_SubtermAttribute = Core.Name "hydra.paths.SubtermAttribute"

_SubtermAttribute_path = Core.Name "path"

_SubtermAttribute_target = Core.Name "target"

-- | A link from a node to another binding of the graph, addressed by the path at which it occurs
data SubtermEdge =
  SubtermEdge {
    -- | The subterm path at which the reference occurs
    subtermEdgePath :: SubtermPath,
    -- | The name of the referenced binding of the graph
    subtermEdgeTarget :: Core.Name}
  deriving (Eq, Ord, Read, Show)

_SubtermEdge = Core.Name "hydra.paths.SubtermEdge"

_SubtermEdge_path = Core.Name "path"

_SubtermEdge_target = Core.Name "target"

-- | The link view of a graph as subterm nodes and their links
data SubtermGraph =
  SubtermGraph {
    -- | All nodes in the graph
    subtermGraphNodes :: [SubtermNode]}
  deriving (Eq, Ord, Read, Show)

_SubtermGraph = Core.Name "hydra.paths.SubtermGraph"

_SubtermGraph_nodes = Core.Name "nodes"

-- | An outgoing link of a subterm node: an edge, a property, or an attribute
data SubtermLink =
  -- | A reference to another binding of the graph
  SubtermLinkEdge SubtermEdge |
  -- | A leaf term
  SubtermLinkProperty SubtermProperty |
  -- | A non-term attribute of a position
  SubtermLinkAttribute SubtermAttribute
  deriving (Eq, Ord, Read, Show)

_SubtermLink = Core.Name "hydra.paths.SubtermLink"

_SubtermLink_edge = Core.Name "edge"

_SubtermLink_property = Core.Name "property"

_SubtermLink_attribute = Core.Name "attribute"

-- | A node in a subterm graph: a binding of the graph, with its type scheme and outgoing links
data SubtermNode =
  SubtermNode {
    -- | The name of the binding
    subtermNodeName :: Core.Name,
    -- | The type scheme of the binding
    subtermNodeType :: Core.TypeScheme,
    -- | The outgoing links of the node
    subtermNodeLinks :: [SubtermLink]}
  deriving (Eq, Ord, Read, Show)

_SubtermNode = Core.Name "hydra.paths.SubtermNode"

_SubtermNode_name = Core.Name "name"

_SubtermNode_type = Core.Name "type"

_SubtermNode_links = Core.Name "links"

-- | A sequence of subterm steps forming a path through a term, root first
newtype SubtermPath =
  SubtermPath {
    unSubtermPath :: [SubtermStep]}
  deriving (Eq, Ord, Read, Show)

_SubtermPath = Core.Name "hydra.paths.SubtermPath"

-- | A link from a node to a leaf term (literal, unit, projection, unwrap, or an unbound variable)
data SubtermProperty =
  SubtermProperty {
    -- | The subterm path at which the leaf term occurs
    subtermPropertyPath :: SubtermPath,
    -- | The leaf term
    subtermPropertyTarget :: Core.Term}
  deriving (Eq, Ord, Read, Show)

_SubtermProperty = Core.Name "hydra.paths.SubtermProperty"

_SubtermProperty_path = Core.Name "path"

_SubtermProperty_target = Core.Name "target"

-- | A function which maps from a term to a particular immediate subterm
data SubtermStep =
  -- | Access the annotation of an annotated term
  SubtermStepAnnotatedAnnotation |
  -- | Access the body of an annotated term
  SubtermStepAnnotatedBody |
  -- | Access the argument of an application term
  SubtermStepApplicationArgument |
  -- | Access the function of an application term
  SubtermStepApplicationFunction |
  -- | Access the handler of a specific case of a case statement by field name
  SubtermStepCasesCase Core.Name |
  -- | Access the default case of a case statement
  SubtermStepCasesDefault |
  -- | Access the left term of an either value
  SubtermStepEitherLeft |
  -- | Access the right term of an either value
  SubtermStepEitherRight |
  -- | Access the injected term of a union injection by field name
  SubtermStepInjectField Core.Name |
  -- | Access the body of a lambda term
  SubtermStepLambdaBody |
  -- | Access a specific binding in a let term by variable name
  SubtermStepLetBinding Core.Name |
  -- | Access the body of a let term
  SubtermStepLetBody |
  -- | Access an element of a list by index
  SubtermStepListElement Int |
  -- | Access the key of the map entry at the given index
  SubtermStepMapKey Int |
  -- | Access the value of the map entry at the given index
  SubtermStepMapValue Int |
  -- | Access the term inside a given (present) optional value
  SubtermStepOptionalGiven |
  -- | Access the first term of a pair
  SubtermStepPairFirst |
  -- | Access the second term of a pair
  SubtermStepPairSecond |
  -- | Access a field of a record by field name
  SubtermStepRecordField Core.Name |
  -- | Access an element of a set by index
  SubtermStepSetElement Int |
  -- | Access the body of a type application term
  SubtermStepTypeApplicationBody |
  -- | Access the body of a type lambda term
  SubtermStepTypeLambdaBody |
  -- | Access the body of a wrapped term
  SubtermStepWrapBody
  deriving (Eq, Ord, Read, Show)

_SubtermStep = Core.Name "hydra.paths.SubtermStep"

_SubtermStep_annotatedAnnotation = Core.Name "annotatedAnnotation"

_SubtermStep_annotatedBody = Core.Name "annotatedBody"

_SubtermStep_applicationArgument = Core.Name "applicationArgument"

_SubtermStep_applicationFunction = Core.Name "applicationFunction"

_SubtermStep_casesCase = Core.Name "casesCase"

_SubtermStep_casesDefault = Core.Name "casesDefault"

_SubtermStep_eitherLeft = Core.Name "eitherLeft"

_SubtermStep_eitherRight = Core.Name "eitherRight"

_SubtermStep_injectField = Core.Name "injectField"

_SubtermStep_lambdaBody = Core.Name "lambdaBody"

_SubtermStep_letBinding = Core.Name "letBinding"

_SubtermStep_letBody = Core.Name "letBody"

_SubtermStep_listElement = Core.Name "listElement"

_SubtermStep_mapKey = Core.Name "mapKey"

_SubtermStep_mapValue = Core.Name "mapValue"

_SubtermStep_optionalGiven = Core.Name "optionalGiven"

_SubtermStep_pairFirst = Core.Name "pairFirst"

_SubtermStep_pairSecond = Core.Name "pairSecond"

_SubtermStep_recordField = Core.Name "recordField"

_SubtermStep_setElement = Core.Name "setElement"

_SubtermStep_typeApplicationBody = Core.Name "typeApplicationBody"

_SubtermStep_typeLambdaBody = Core.Name "typeLambdaBody"

_SubtermStep_wrapBody = Core.Name "wrapBody"

-- | A link from a node to a non-type attribute of a position
data SubtypeAttribute =
  SubtypeAttribute {
    -- | The subtype path at which the attribute occurs
    subtypeAttributePath :: SubtypePath,
    -- | The attribute value
    subtypeAttributeTarget :: TypeAttribute}
  deriving (Eq, Ord, Read, Show)

_SubtypeAttribute = Core.Name "hydra.paths.SubtypeAttribute"

_SubtypeAttribute_path = Core.Name "path"

_SubtypeAttribute_target = Core.Name "target"

-- | A link from a node to a named type, addressed by the path at which it occurs
data SubtypeEdge =
  SubtypeEdge {
    -- | The subtype path at which the reference occurs
    subtypeEdgePath :: SubtypePath,
    -- | The name of the referenced type
    subtypeEdgeTarget :: Core.Name}
  deriving (Eq, Ord, Read, Show)

_SubtypeEdge = Core.Name "hydra.paths.SubtypeEdge"

_SubtypeEdge_path = Core.Name "path"

_SubtypeEdge_target = Core.Name "target"

-- | The link view of a schema as subtype nodes and their links
data SubtypeGraph =
  SubtypeGraph {
    -- | All nodes in the graph
    subtypeGraphNodes :: [SubtypeNode]}
  deriving (Eq, Ord, Read, Show)

_SubtypeGraph = Core.Name "hydra.paths.SubtypeGraph"

_SubtypeGraph_nodes = Core.Name "nodes"

-- | An outgoing link of a subtype node: an edge, a property, or an attribute
data SubtypeLink =
  -- | A reference to a named type
  SubtypeLinkEdge SubtypeEdge |
  -- | A leaf type
  SubtypeLinkProperty SubtypeProperty |
  -- | A non-type attribute of a position
  SubtypeLinkAttribute SubtypeAttribute
  deriving (Eq, Ord, Read, Show)

_SubtypeLink = Core.Name "hydra.paths.SubtypeLink"

_SubtypeLink_edge = Core.Name "edge"

_SubtypeLink_property = Core.Name "property"

_SubtypeLink_attribute = Core.Name "attribute"

-- | A node in a subtype graph: a named type, with its outgoing links
data SubtypeNode =
  SubtypeNode {
    -- | The name of the type
    subtypeNodeName :: Core.Name,
    -- | The outgoing links of the node
    subtypeNodeLinks :: [SubtypeLink]}
  deriving (Eq, Ord, Read, Show)

_SubtypeNode = Core.Name "hydra.paths.SubtypeNode"

_SubtypeNode_name = Core.Name "name"

_SubtypeNode_links = Core.Name "links"

-- | A sequence of subtype steps forming a path through a type, root first
newtype SubtypePath =
  SubtypePath {
    unSubtypePath :: [SubtypeStep]}
  deriving (Eq, Ord, Read, Show)

_SubtypePath = Core.Name "hydra.paths.SubtypePath"

-- | A link from a node to a leaf type (literal, unit, void, or a bound variable)
data SubtypeProperty =
  SubtypeProperty {
    -- | The subtype path at which the leaf type occurs
    subtypePropertyPath :: SubtypePath,
    -- | The leaf type
    subtypePropertyTarget :: Core.Type}
  deriving (Eq, Ord, Read, Show)

_SubtypeProperty = Core.Name "hydra.paths.SubtypeProperty"

_SubtypeProperty_path = Core.Name "path"

_SubtypeProperty_target = Core.Name "target"

-- | A function which maps from a type to a particular immediate subtype
data SubtypeStep =
  -- | Access the body of an annotated type (the annotation is a term; there is no step for it)
  SubtypeStepAnnotatedBody |
  -- | Access the argument of an application type
  SubtypeStepApplicationArgument |
  -- | Access the function of an application type
  SubtypeStepApplicationFunction |
  -- | Access the value type of an effect type
  SubtypeStepEffectValue |
  -- | Access the left type of an either type
  SubtypeStepEitherLeft |
  -- | Access the right type of an either type
  SubtypeStepEitherRight |
  -- | Access the body of a universally quantified type
  SubtypeStepForallBody |
  -- | Access the codomain type of a function type
  SubtypeStepFunctionCodomain |
  -- | Access the domain type of a function type
  SubtypeStepFunctionDomain |
  -- | Access the element type of a list type
  SubtypeStepListElement |
  -- | Access the key type of a map type
  SubtypeStepMapKeys |
  -- | Access the value type of a map type
  SubtypeStepMapValues |
  -- | Access the element type of an optional type
  SubtypeStepOptionalElement |
  -- | Access the first type of a pair type
  SubtypeStepPairFirst |
  -- | Access the second type of a pair type
  SubtypeStepPairSecond |
  -- | Access a field type of a record type by field name
  SubtypeStepRecordField Core.Name |
  -- | Access the element type of a set type
  SubtypeStepSetElement |
  -- | Access a field type of a union type by field name
  SubtypeStepUnionField Core.Name |
  -- | Access the body type of a wrapped type
  SubtypeStepWrapBody
  deriving (Eq, Ord, Read, Show)

_SubtypeStep = Core.Name "hydra.paths.SubtypeStep"

_SubtypeStep_annotatedBody = Core.Name "annotatedBody"

_SubtypeStep_applicationArgument = Core.Name "applicationArgument"

_SubtypeStep_applicationFunction = Core.Name "applicationFunction"

_SubtypeStep_effectValue = Core.Name "effectValue"

_SubtypeStep_eitherLeft = Core.Name "eitherLeft"

_SubtypeStep_eitherRight = Core.Name "eitherRight"

_SubtypeStep_forallBody = Core.Name "forallBody"

_SubtypeStep_functionCodomain = Core.Name "functionCodomain"

_SubtypeStep_functionDomain = Core.Name "functionDomain"

_SubtypeStep_listElement = Core.Name "listElement"

_SubtypeStep_mapKeys = Core.Name "mapKeys"

_SubtypeStep_mapValues = Core.Name "mapValues"

_SubtypeStep_optionalElement = Core.Name "optionalElement"

_SubtypeStep_pairFirst = Core.Name "pairFirst"

_SubtypeStep_pairSecond = Core.Name "pairSecond"

_SubtypeStep_recordField = Core.Name "recordField"

_SubtypeStep_setElement = Core.Name "setElement"

_SubtypeStep_unionField = Core.Name "unionField"

_SubtypeStep_wrapBody = Core.Name "wrapBody"

-- | A non-term constituent of the term at a path, together with its value
data TermAttribute =
  -- | The name of the union type eliminated by a case statement
  TermAttributeCasesTypeName Core.Name |
  -- | The name of the union type of an injection
  TermAttributeInjectTypeName Core.Name |
  -- | The (given) domain type of a lambda
  TermAttributeLambdaDomainGiven Core.Type |
  -- | The parameter name of a lambda
  TermAttributeLambdaParameter Core.Name |
  -- | The name of a let binding together with its (given) type scheme
  TermAttributeLetBindingTypeSchemeGiven (Core.Name, Core.TypeScheme) |
  -- | The name of the field projected by a projection
  TermAttributeProjectFieldName Core.Name |
  -- | The name of the record type of a projection
  TermAttributeProjectTypeName Core.Name |
  -- | The name of the record type of a record term
  TermAttributeRecordTypeName Core.Name |
  -- | The type argument of a type application term
  TermAttributeTypeApplicationType Core.Type |
  -- | The type-variable parameter of a type lambda term
  TermAttributeTypeLambdaParameter Core.Name |
  -- | The name of the wrapper type of a wrapped term
  TermAttributeWrapTypeName Core.Name
  deriving (Eq, Ord, Read, Show)

_TermAttribute = Core.Name "hydra.paths.TermAttribute"

_TermAttribute_casesTypeName = Core.Name "casesTypeName"

_TermAttribute_injectTypeName = Core.Name "injectTypeName"

_TermAttribute_lambdaDomainGiven = Core.Name "lambdaDomainGiven"

_TermAttribute_lambdaParameter = Core.Name "lambdaParameter"

_TermAttribute_letBindingTypeSchemeGiven = Core.Name "letBindingTypeSchemeGiven"

_TermAttribute_projectFieldName = Core.Name "projectFieldName"

_TermAttribute_projectTypeName = Core.Name "projectTypeName"

_TermAttribute_recordTypeName = Core.Name "recordTypeName"

_TermAttribute_typeApplicationType = Core.Name "typeApplicationType"

_TermAttribute_typeLambdaParameter = Core.Name "typeLambdaParameter"

_TermAttribute_wrapTypeName = Core.Name "wrapTypeName"

-- | A non-type constituent of the type at a path, together with its value
data TypeAttribute =
  -- | The annotation of an annotated type (a term; not descended into)
  TypeAttributeAnnotatedAnnotation Core.Term |
  -- | The type-variable parameter of a universally quantified type
  TypeAttributeForallParameter Core.Name
  deriving (Eq, Ord, Read, Show)

_TypeAttribute = Core.Name "hydra.paths.TypeAttribute"

_TypeAttribute_annotatedAnnotation = Core.Name "annotatedAnnotation"

_TypeAttribute_forallParameter = Core.Name "forallParameter"