{-# LANGUAGE OverloadedStrings #-}
module Hydra.Impl.Haskell.Sources.Compute where
import Hydra.All
import Hydra.Impl.Haskell.Dsl.Types as Types
import Hydra.Impl.Haskell.Dsl.Standard
import Hydra.Impl.Haskell.Sources.Core
import Hydra.Impl.Haskell.Sources.Mantle
hydraComputeModule :: Module Meta
hydraComputeModule :: Module Meta
hydraComputeModule = forall m.
Namespace -> [Element m] -> [Module m] -> Maybe String -> Module m
Module Namespace
ns [Element Meta]
elements [Module Meta
hydraMantleModule] forall a b. (a -> b) -> a -> b
$
forall a. a -> Maybe a
Just String
"Abstractions for evaluation and transformations"
where
ns :: Namespace
ns = String -> Namespace
Namespace String
"hydra/compute"
core :: String -> Type m
core = forall m. Namespace -> String -> Type m
nsref forall a b. (a -> b) -> a -> b
$ forall m. Module m -> Namespace
moduleNamespace Module Meta
hydraCoreModule
mantle :: String -> Type m
mantle = forall m. Namespace -> String -> Type m
nsref forall a b. (a -> b) -> a -> b
$ forall m. Module m -> Namespace
moduleNamespace Module Meta
hydraMantleModule
compute :: String -> Type m
compute = forall m. Namespace -> String -> Type m
nsref Namespace
ns
def :: String -> Type m -> Element m
def = forall m. Namespace -> String -> Type m -> Element m
datatype Namespace
ns
elements :: [Element Meta]
elements = [
forall {m}. String -> Type m -> Element m
def String
"Adapter" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"s1" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"s2" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"t1" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"t2" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"v1" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"v2" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"isLossy"forall m. String -> Type m -> FieldType m
>: forall m. Type m
boolean,
String
"source"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
variable String
"t1",
String
"target"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
variable String
"t2",
String
"coder"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
compute String
"Coder" forall m. Type m -> Type m -> Type m
@@ Type Meta
"s1" forall m. Type m -> Type m -> Type m
@@ Type Meta
"s2" forall m. Type m -> Type m -> Type m
@@ Type Meta
"v1" forall m. Type m -> Type m -> Type m
@@ Type Meta
"v2"],
forall {m}. String -> Type m -> Element m
def String
"AdapterContext" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"m" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"evaluation"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m -> Type m
apply (forall m. String -> Type m
compute String
"Context") (forall m. String -> Type m
variable String
"m"),
String
"source"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m -> Type m
apply (forall m. String -> Type m
compute String
"Language") (forall m. String -> Type m
variable String
"m"),
String
"target"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m -> Type m
apply (forall m. String -> Type m
compute String
"Language") (forall m. String -> Type m
variable String
"m")],
forall {m}. String -> Type m -> Element m
def String
"AnnotationClass" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"A typeclass-like construct providing common functions for working with annotations" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"m" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"default"forall m. String -> Type m -> FieldType m
>: Type Meta
"m",
String
"equal"forall m. String -> Type m -> FieldType m
>: Type Meta
"m" forall m. Type m -> Type m -> Type m
--> Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. Type m
boolean,
String
"compare"forall m. String -> Type m -> FieldType m
>: Type Meta
"m" forall m. Type m -> Type m -> Type m
--> Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
mantle String
"Comparison",
String
"show"forall m. String -> Type m -> FieldType m
>: Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. Type m
string,
String
"read"forall m. String -> Type m -> FieldType m
>: forall m. Type m
string forall m. Type m -> Type m -> Type m
--> forall m. Type m -> Type m
optional Type Meta
"m",
String
"termMeta"forall m. String -> Type m -> FieldType m
>:
forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> Type Meta
"m",
String
"typeMeta"forall m. String -> Type m -> FieldType m
>:
forall m. String -> Type m
core String
"Type" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> Type Meta
"m",
String
"termDescription"forall m. String -> Type m -> FieldType m
>:
forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
compute String
"Flow" forall m. Type m -> Type m -> Type m
@@ (forall m. String -> Type m
compute String
"Context" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
@@ forall m. Type m -> Type m
optional forall m. Type m
string,
String
"typeDescription"forall m. String -> Type m -> FieldType m
>:
forall m. String -> Type m
core String
"Type" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
compute String
"Flow" forall m. Type m -> Type m -> Type m
@@ (forall m. String -> Type m
compute String
"Context" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
@@ forall m. Type m -> Type m
optional forall m. Type m
string,
String
"termType"forall m. String -> Type m -> FieldType m
>:
forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
compute String
"Flow" forall m. Type m -> Type m -> Type m
@@ (forall m. String -> Type m
compute String
"Context" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
@@ forall m. Type m -> Type m
optional (forall m. String -> Type m
core String
"Type" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m"),
String
"setTermDescription"forall m. String -> Type m -> FieldType m
>:
forall m. String -> Type m
compute String
"Context" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. Type m -> Type m
optional forall m. Type m
string forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m",
String
"setTermType"forall m. String -> Type m -> FieldType m
>:
forall m. String -> Type m
compute String
"Context" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. Type m -> Type m
optional (forall m. String -> Type m
core String
"Type" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m",
String
"typeOf"forall m. String -> Type m -> FieldType m
>:
Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
compute String
"Flow" forall m. Type m -> Type m -> Type m
@@ (forall m. String -> Type m
compute String
"Context" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
@@ forall m. Type m -> Type m
optional (forall m. String -> Type m
core String
"Type" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m"),
String
"setTypeOf"forall m. String -> Type m -> FieldType m
>:
forall m. Type m -> Type m
optional (forall m. String -> Type m
core String
"Type" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
--> Type Meta
"m" forall m. Type m -> Type m -> Type m
--> Type Meta
"m"],
forall {m}. String -> Type m -> Element m
def String
"Coder" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"An encoder and decoder; a bidirectional flow between two types" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"s1" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"s2" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"v1" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"v2" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"encode"forall m. String -> Type m -> FieldType m
>: (Type Meta
"v1" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
compute String
"Flow" forall m. Type m -> Type m -> Type m
@@ Type Meta
"s1" forall m. Type m -> Type m -> Type m
@@ Type Meta
"v2"),
String
"decode"forall m. String -> Type m -> FieldType m
>: (Type Meta
"v2" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
compute String
"Flow" forall m. Type m -> Type m -> Type m
@@ Type Meta
"s2" forall m. Type m -> Type m -> Type m
@@ Type Meta
"v1")],
forall {m}. String -> Type m -> Element m
def String
"CoderDirection" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"Indicates either the 'out' or the 'in' direction of a coder" forall a b. (a -> b) -> a -> b
$
forall m. [String] -> Type m
enum [
String
"encode",
String
"decode"],
forall {m}. String -> Type m -> Element m
def String
"Context" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"An environment containing a graph together with primitive functions and other necessary components for evaluation" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"m" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"graph"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
mantle String
"Graph" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m",
String
"functions"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m -> Type m
Types.map (forall m. String -> Type m
core String
"Name") (forall m. String -> Type m
compute String
"PrimitiveFunction" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m"),
String
"strategy"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
compute String
"EvaluationStrategy",
String
"annotations"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
compute String
"AnnotationClass" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m"],
forall {m}. String -> Type m -> Element m
def String
"EvaluationStrategy" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"Settings which determine how terms are evaluated" forall a b. (a -> b) -> a -> b
$
forall m. [FieldType m] -> Type m
record [
String
"opaqueTermVariants"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
set (forall m. String -> Type m
mantle String
"TermVariant")],
forall {m}. String -> Type m -> Element m
def String
"Flow" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"A variant of the State monad with built-in logging and error handling" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"s" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"a" forall a b. (a -> b) -> a -> b
$
forall m. Type m -> Type m -> Type m
function Type Meta
"s" (forall m. String -> Type m
compute String
"Trace" forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
compute String
"FlowState" forall m. Type m -> Type m -> Type m
@@ Type Meta
"s" forall m. Type m -> Type m -> Type m
@@ Type Meta
"a"),
forall {m}. String -> Type m -> Element m
def String
"FlowState" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"s" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"a" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"value"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
optional Type Meta
"a",
String
"state"forall m. String -> Type m -> FieldType m
>: Type Meta
"s",
String
"trace"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
compute String
"Trace"],
forall {m}. String -> Type m -> Element m
def String
"Language" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"m" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"name"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
compute String
"LanguageName",
String
"constraints"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m -> Type m
apply (forall m. String -> Type m
compute String
"LanguageConstraints") (forall m. String -> Type m
variable String
"m")],
forall {m}. String -> Type m -> Element m
def String
"LanguageConstraints" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"m" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"eliminationVariants"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
Types.set forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m
mantle String
"EliminationVariant",
String
"literalVariants"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
Types.set forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m
mantle String
"LiteralVariant",
String
"floatTypes"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
Types.set forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m
core String
"FloatType",
String
"functionVariants"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
Types.set forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m
mantle String
"FunctionVariant",
String
"integerTypes"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
Types.set forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m
core String
"IntegerType",
String
"termVariants"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
Types.set forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m
mantle String
"TermVariant",
String
"typeVariants"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
Types.set forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m
mantle String
"TypeVariant",
String
"types"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
core String
"Type" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m" forall m. Type m -> Type m -> Type m
--> forall m. Type m
boolean],
forall {m}. String -> Type m -> Element m
def String
"LanguageName" forall m. Type m
string,
forall {m}. String -> Type m -> Element m
def String
"Meta" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"A built-in metadata container for terms" forall a b. (a -> b) -> a -> b
$
forall m. [FieldType m] -> Type m
record [
String
"annotations"forall m. String -> Type m -> FieldType m
>:
String -> Type Meta -> Type Meta
doc String
"A map of annotation names to annotation values" forall a b. (a -> b) -> a -> b
$
forall m. Type m -> Type m -> Type m
Types.map forall m. Type m
string (forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ forall m. String -> Type m
compute String
"Meta")],
forall {m}. String -> Type m -> Element m
def String
"PrimitiveFunction" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"A built-in function" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"m" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"name"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
core String
"Name",
String
"type"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
core String
"FunctionType" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m",
String
"implementation"forall m. String -> Type m -> FieldType m
>:
forall m. Type m -> Type m
list (forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
--> forall m. String -> Type m
compute String
"Flow" forall m. Type m -> Type m -> Type m
@@ (forall m. String -> Type m
compute String
"Context" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
@@ (forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m")],
forall {m}. String -> Type m -> Element m
def String
"TermCoder" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"A type together with a coder for mapping terms into arguments for primitive functions, and mapping computed results into terms" forall a b. (a -> b) -> a -> b
$
forall m. String -> Type m -> Type m
lambda String
"m" forall a b. (a -> b) -> a -> b
$ forall m. String -> Type m -> Type m
lambda String
"a" forall a b. (a -> b) -> a -> b
$ forall m. [FieldType m] -> Type m
record [
String
"type"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
core String
"Type" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m",
String
"coder"forall m. String -> Type m -> FieldType m
>: forall m. String -> Type m
compute String
"Coder" forall m. Type m -> Type m -> Type m
@@ (forall m. String -> Type m
compute String
"Context" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
@@ (forall m. String -> Type m
compute String
"Context" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
@@ (forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ Type Meta
"m") forall m. Type m -> Type m -> Type m
@@ Type Meta
"a"],
forall {m}. String -> Type m -> Element m
def String
"Trace" forall a b. (a -> b) -> a -> b
$
String -> Type Meta -> Type Meta
doc String
"A container for logging and error information" forall a b. (a -> b) -> a -> b
$
forall m. [FieldType m] -> Type m
record [
String
"stack"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
list forall m. Type m
string,
String
"messages"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
list forall m. Type m
string,
String
"other"forall m. String -> Type m -> FieldType m
>:
String -> Type Meta -> Type Meta
doc String
"A map of string keys to arbitrary terms as values, for application-specific use" forall a b. (a -> b) -> a -> b
$
forall m. Type m -> Type m -> Type m
Types.map forall m. Type m
string (forall m. String -> Type m
core String
"Term" forall m. Type m -> Type m -> Type m
@@ forall m. String -> Type m
compute String
"Meta")],
forall {m}. String -> Type m -> Element m
def String
"TraversalOrder" forall a b. (a -> b) -> a -> b
$
forall m. [FieldType m] -> Type m
union [
String
"pre"forall m. String -> Type m -> FieldType m
>: String -> Type Meta -> Type Meta
doc String
"Pre-order traversal" forall m. Type m
unit,
String
"post"forall m. String -> Type m -> FieldType m
>: String -> Type Meta -> Type Meta
doc String
"Post-order traversal" forall m. Type m
unit]]