-- | A set of types which supplement hydra/core with type variants, graphs, and elements

module Hydra.Mantle where

import qualified Hydra.Core as Core
import Data.List
import Data.Map
import Data.Set

-- | An equality judgement: less than, equal to, or greater than
data Comparison = 
  ComparisonLessThan  |
  ComparisonEqualTo  |
  ComparisonGreaterThan 
  deriving (Comparison -> Comparison -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Comparison -> Comparison -> Bool
$c/= :: Comparison -> Comparison -> Bool
== :: Comparison -> Comparison -> Bool
$c== :: Comparison -> Comparison -> Bool
Eq, Eq Comparison
Comparison -> Comparison -> Bool
Comparison -> Comparison -> Ordering
Comparison -> Comparison -> Comparison
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Comparison -> Comparison -> Comparison
$cmin :: Comparison -> Comparison -> Comparison
max :: Comparison -> Comparison -> Comparison
$cmax :: Comparison -> Comparison -> Comparison
>= :: Comparison -> Comparison -> Bool
$c>= :: Comparison -> Comparison -> Bool
> :: Comparison -> Comparison -> Bool
$c> :: Comparison -> Comparison -> Bool
<= :: Comparison -> Comparison -> Bool
$c<= :: Comparison -> Comparison -> Bool
< :: Comparison -> Comparison -> Bool
$c< :: Comparison -> Comparison -> Bool
compare :: Comparison -> Comparison -> Ordering
$ccompare :: Comparison -> Comparison -> Ordering
Ord, ReadPrec [Comparison]
ReadPrec Comparison
Int -> ReadS Comparison
ReadS [Comparison]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Comparison]
$creadListPrec :: ReadPrec [Comparison]
readPrec :: ReadPrec Comparison
$creadPrec :: ReadPrec Comparison
readList :: ReadS [Comparison]
$creadList :: ReadS [Comparison]
readsPrec :: Int -> ReadS Comparison
$creadsPrec :: Int -> ReadS Comparison
Read, Int -> Comparison -> ShowS
[Comparison] -> ShowS
Comparison -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Comparison] -> ShowS
$cshowList :: [Comparison] -> ShowS
show :: Comparison -> String
$cshow :: Comparison -> String
showsPrec :: Int -> Comparison -> ShowS
$cshowsPrec :: Int -> Comparison -> ShowS
Show)

_Comparison :: Name
_Comparison = (String -> Name
Core.Name String
"hydra/mantle.Comparison")

_Comparison_lessThan :: FieldName
_Comparison_lessThan = (String -> FieldName
Core.FieldName String
"lessThan")

_Comparison_equalTo :: FieldName
_Comparison_equalTo = (String -> FieldName
Core.FieldName String
"equalTo")

_Comparison_greaterThan :: FieldName
_Comparison_greaterThan = (String -> FieldName
Core.FieldName String
"greaterThan")

-- | A graph element, having a name, data term (value), and schema term (type)
data Element m = 
  Element {
    forall m. Element m -> Name
elementName :: Core.Name,
    forall m. Element m -> Term m
elementSchema :: (Core.Term m),
    forall m. Element m -> Term m
elementData :: (Core.Term m)}
  deriving (Element m -> Element m -> Bool
forall m. Eq m => Element m -> Element m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Element m -> Element m -> Bool
$c/= :: forall m. Eq m => Element m -> Element m -> Bool
== :: Element m -> Element m -> Bool
$c== :: forall m. Eq m => Element m -> Element m -> Bool
Eq, Element m -> Element m -> Bool
Element m -> Element m -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {m}. Ord m => Eq (Element m)
forall m. Ord m => Element m -> Element m -> Bool
forall m. Ord m => Element m -> Element m -> Ordering
forall m. Ord m => Element m -> Element m -> Element m
min :: Element m -> Element m -> Element m
$cmin :: forall m. Ord m => Element m -> Element m -> Element m
max :: Element m -> Element m -> Element m
$cmax :: forall m. Ord m => Element m -> Element m -> Element m
>= :: Element m -> Element m -> Bool
$c>= :: forall m. Ord m => Element m -> Element m -> Bool
> :: Element m -> Element m -> Bool
$c> :: forall m. Ord m => Element m -> Element m -> Bool
<= :: Element m -> Element m -> Bool
$c<= :: forall m. Ord m => Element m -> Element m -> Bool
< :: Element m -> Element m -> Bool
$c< :: forall m. Ord m => Element m -> Element m -> Bool
compare :: Element m -> Element m -> Ordering
$ccompare :: forall m. Ord m => Element m -> Element m -> Ordering
Ord, ReadPrec [Element m]
ReadPrec (Element m)
ReadS [Element m]
forall m. (Read m, Ord m) => ReadPrec [Element m]
forall m. (Read m, Ord m) => ReadPrec (Element m)
forall m. (Read m, Ord m) => Int -> ReadS (Element m)
forall m. (Read m, Ord m) => ReadS [Element m]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Element m]
$creadListPrec :: forall m. (Read m, Ord m) => ReadPrec [Element m]
readPrec :: ReadPrec (Element m)
$creadPrec :: forall m. (Read m, Ord m) => ReadPrec (Element m)
readList :: ReadS [Element m]
$creadList :: forall m. (Read m, Ord m) => ReadS [Element m]
readsPrec :: Int -> ReadS (Element m)
$creadsPrec :: forall m. (Read m, Ord m) => Int -> ReadS (Element m)
Read, Int -> Element m -> ShowS
forall m. Show m => Int -> Element m -> ShowS
forall m. Show m => [Element m] -> ShowS
forall m. Show m => Element m -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Element m] -> ShowS
$cshowList :: forall m. Show m => [Element m] -> ShowS
show :: Element m -> String
$cshow :: forall m. Show m => Element m -> String
showsPrec :: Int -> Element m -> ShowS
$cshowsPrec :: forall m. Show m => Int -> Element m -> ShowS
Show)

_Element :: Name
_Element = (String -> Name
Core.Name String
"hydra/mantle.Element")

_Element_name :: FieldName
_Element_name = (String -> FieldName
Core.FieldName String
"name")

_Element_schema :: FieldName
_Element_schema = (String -> FieldName
Core.FieldName String
"schema")

_Element_data :: FieldName
_Element_data = (String -> FieldName
Core.FieldName String
"data")

-- | The identifier of an elimination constructor
data EliminationVariant = 
  EliminationVariantElement  |
  EliminationVariantList  |
  EliminationVariantNominal  |
  EliminationVariantOptional  |
  EliminationVariantRecord  |
  EliminationVariantUnion 
  deriving (EliminationVariant -> EliminationVariant -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EliminationVariant -> EliminationVariant -> Bool
$c/= :: EliminationVariant -> EliminationVariant -> Bool
== :: EliminationVariant -> EliminationVariant -> Bool
$c== :: EliminationVariant -> EliminationVariant -> Bool
Eq, Eq EliminationVariant
EliminationVariant -> EliminationVariant -> Bool
EliminationVariant -> EliminationVariant -> Ordering
EliminationVariant -> EliminationVariant -> EliminationVariant
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EliminationVariant -> EliminationVariant -> EliminationVariant
$cmin :: EliminationVariant -> EliminationVariant -> EliminationVariant
max :: EliminationVariant -> EliminationVariant -> EliminationVariant
$cmax :: EliminationVariant -> EliminationVariant -> EliminationVariant
>= :: EliminationVariant -> EliminationVariant -> Bool
$c>= :: EliminationVariant -> EliminationVariant -> Bool
> :: EliminationVariant -> EliminationVariant -> Bool
$c> :: EliminationVariant -> EliminationVariant -> Bool
<= :: EliminationVariant -> EliminationVariant -> Bool
$c<= :: EliminationVariant -> EliminationVariant -> Bool
< :: EliminationVariant -> EliminationVariant -> Bool
$c< :: EliminationVariant -> EliminationVariant -> Bool
compare :: EliminationVariant -> EliminationVariant -> Ordering
$ccompare :: EliminationVariant -> EliminationVariant -> Ordering
Ord, ReadPrec [EliminationVariant]
ReadPrec EliminationVariant
Int -> ReadS EliminationVariant
ReadS [EliminationVariant]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EliminationVariant]
$creadListPrec :: ReadPrec [EliminationVariant]
readPrec :: ReadPrec EliminationVariant
$creadPrec :: ReadPrec EliminationVariant
readList :: ReadS [EliminationVariant]
$creadList :: ReadS [EliminationVariant]
readsPrec :: Int -> ReadS EliminationVariant
$creadsPrec :: Int -> ReadS EliminationVariant
Read, Int -> EliminationVariant -> ShowS
[EliminationVariant] -> ShowS
EliminationVariant -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EliminationVariant] -> ShowS
$cshowList :: [EliminationVariant] -> ShowS
show :: EliminationVariant -> String
$cshow :: EliminationVariant -> String
showsPrec :: Int -> EliminationVariant -> ShowS
$cshowsPrec :: Int -> EliminationVariant -> ShowS
Show)

_EliminationVariant :: Name
_EliminationVariant = (String -> Name
Core.Name String
"hydra/mantle.EliminationVariant")

_EliminationVariant_element :: FieldName
_EliminationVariant_element = (String -> FieldName
Core.FieldName String
"element")

_EliminationVariant_list :: FieldName
_EliminationVariant_list = (String -> FieldName
Core.FieldName String
"list")

_EliminationVariant_nominal :: FieldName
_EliminationVariant_nominal = (String -> FieldName
Core.FieldName String
"nominal")

_EliminationVariant_optional :: FieldName
_EliminationVariant_optional = (String -> FieldName
Core.FieldName String
"optional")

_EliminationVariant_record :: FieldName
_EliminationVariant_record = (String -> FieldName
Core.FieldName String
"record")

_EliminationVariant_union :: FieldName
_EliminationVariant_union = (String -> FieldName
Core.FieldName String
"union")

-- | The identifier of a function constructor
data FunctionVariant = 
  FunctionVariantCompareTo  |
  FunctionVariantElimination  |
  FunctionVariantLambda  |
  FunctionVariantPrimitive 
  deriving (FunctionVariant -> FunctionVariant -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionVariant -> FunctionVariant -> Bool
$c/= :: FunctionVariant -> FunctionVariant -> Bool
== :: FunctionVariant -> FunctionVariant -> Bool
$c== :: FunctionVariant -> FunctionVariant -> Bool
Eq, Eq FunctionVariant
FunctionVariant -> FunctionVariant -> Bool
FunctionVariant -> FunctionVariant -> Ordering
FunctionVariant -> FunctionVariant -> FunctionVariant
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FunctionVariant -> FunctionVariant -> FunctionVariant
$cmin :: FunctionVariant -> FunctionVariant -> FunctionVariant
max :: FunctionVariant -> FunctionVariant -> FunctionVariant
$cmax :: FunctionVariant -> FunctionVariant -> FunctionVariant
>= :: FunctionVariant -> FunctionVariant -> Bool
$c>= :: FunctionVariant -> FunctionVariant -> Bool
> :: FunctionVariant -> FunctionVariant -> Bool
$c> :: FunctionVariant -> FunctionVariant -> Bool
<= :: FunctionVariant -> FunctionVariant -> Bool
$c<= :: FunctionVariant -> FunctionVariant -> Bool
< :: FunctionVariant -> FunctionVariant -> Bool
$c< :: FunctionVariant -> FunctionVariant -> Bool
compare :: FunctionVariant -> FunctionVariant -> Ordering
$ccompare :: FunctionVariant -> FunctionVariant -> Ordering
Ord, ReadPrec [FunctionVariant]
ReadPrec FunctionVariant
Int -> ReadS FunctionVariant
ReadS [FunctionVariant]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FunctionVariant]
$creadListPrec :: ReadPrec [FunctionVariant]
readPrec :: ReadPrec FunctionVariant
$creadPrec :: ReadPrec FunctionVariant
readList :: ReadS [FunctionVariant]
$creadList :: ReadS [FunctionVariant]
readsPrec :: Int -> ReadS FunctionVariant
$creadsPrec :: Int -> ReadS FunctionVariant
Read, Int -> FunctionVariant -> ShowS
[FunctionVariant] -> ShowS
FunctionVariant -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionVariant] -> ShowS
$cshowList :: [FunctionVariant] -> ShowS
show :: FunctionVariant -> String
$cshow :: FunctionVariant -> String
showsPrec :: Int -> FunctionVariant -> ShowS
$cshowsPrec :: Int -> FunctionVariant -> ShowS
Show)

_FunctionVariant :: Name
_FunctionVariant = (String -> Name
Core.Name String
"hydra/mantle.FunctionVariant")

_FunctionVariant_compareTo :: FieldName
_FunctionVariant_compareTo = (String -> FieldName
Core.FieldName String
"compareTo")

_FunctionVariant_elimination :: FieldName
_FunctionVariant_elimination = (String -> FieldName
Core.FieldName String
"elimination")

_FunctionVariant_lambda :: FieldName
_FunctionVariant_lambda = (String -> FieldName
Core.FieldName String
"lambda")

_FunctionVariant_primitive :: FieldName
_FunctionVariant_primitive = (String -> FieldName
Core.FieldName String
"primitive")

-- | A graph, or set of named terms, together with its schema graph
data Graph m = 
  Graph {
    -- | All of the elements in the graph
    forall m. Graph m -> Map Name (Element m)
graphElements :: (Map Core.Name (Element m)),
    -- | The schema graph to this graph. If omitted, the graph is its own schema graph.
    forall m. Graph m -> Maybe (Graph m)
graphSchema :: (Maybe (Graph m))}
  deriving (Graph m -> Graph m -> Bool
forall m. Eq m => Graph m -> Graph m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Graph m -> Graph m -> Bool
$c/= :: forall m. Eq m => Graph m -> Graph m -> Bool
== :: Graph m -> Graph m -> Bool
$c== :: forall m. Eq m => Graph m -> Graph m -> Bool
Eq, Graph m -> Graph m -> Bool
Graph m -> Graph m -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {m}. Ord m => Eq (Graph m)
forall m. Ord m => Graph m -> Graph m -> Bool
forall m. Ord m => Graph m -> Graph m -> Ordering
forall m. Ord m => Graph m -> Graph m -> Graph m
min :: Graph m -> Graph m -> Graph m
$cmin :: forall m. Ord m => Graph m -> Graph m -> Graph m
max :: Graph m -> Graph m -> Graph m
$cmax :: forall m. Ord m => Graph m -> Graph m -> Graph m
>= :: Graph m -> Graph m -> Bool
$c>= :: forall m. Ord m => Graph m -> Graph m -> Bool
> :: Graph m -> Graph m -> Bool
$c> :: forall m. Ord m => Graph m -> Graph m -> Bool
<= :: Graph m -> Graph m -> Bool
$c<= :: forall m. Ord m => Graph m -> Graph m -> Bool
< :: Graph m -> Graph m -> Bool
$c< :: forall m. Ord m => Graph m -> Graph m -> Bool
compare :: Graph m -> Graph m -> Ordering
$ccompare :: forall m. Ord m => Graph m -> Graph m -> Ordering
Ord, ReadPrec [Graph m]
ReadPrec (Graph m)
ReadS [Graph m]
forall m. (Read m, Ord m) => ReadPrec [Graph m]
forall m. (Read m, Ord m) => ReadPrec (Graph m)
forall m. (Read m, Ord m) => Int -> ReadS (Graph m)
forall m. (Read m, Ord m) => ReadS [Graph m]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Graph m]
$creadListPrec :: forall m. (Read m, Ord m) => ReadPrec [Graph m]
readPrec :: ReadPrec (Graph m)
$creadPrec :: forall m. (Read m, Ord m) => ReadPrec (Graph m)
readList :: ReadS [Graph m]
$creadList :: forall m. (Read m, Ord m) => ReadS [Graph m]
readsPrec :: Int -> ReadS (Graph m)
$creadsPrec :: forall m. (Read m, Ord m) => Int -> ReadS (Graph m)
Read, Int -> Graph m -> ShowS
forall m. Show m => Int -> Graph m -> ShowS
forall m. Show m => [Graph m] -> ShowS
forall m. Show m => Graph m -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Graph m] -> ShowS
$cshowList :: forall m. Show m => [Graph m] -> ShowS
show :: Graph m -> String
$cshow :: forall m. Show m => Graph m -> String
showsPrec :: Int -> Graph m -> ShowS
$cshowsPrec :: forall m. Show m => Int -> Graph m -> ShowS
Show)

_Graph :: Name
_Graph = (String -> Name
Core.Name String
"hydra/mantle.Graph")

_Graph_elements :: FieldName
_Graph_elements = (String -> FieldName
Core.FieldName String
"elements")

_Graph_schema :: FieldName
_Graph_schema = (String -> FieldName
Core.FieldName String
"schema")

-- | The identifier of a literal constructor
data LiteralVariant = 
  LiteralVariantBinary  |
  LiteralVariantBoolean  |
  LiteralVariantFloat  |
  LiteralVariantInteger  |
  LiteralVariantString 
  deriving (LiteralVariant -> LiteralVariant -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LiteralVariant -> LiteralVariant -> Bool
$c/= :: LiteralVariant -> LiteralVariant -> Bool
== :: LiteralVariant -> LiteralVariant -> Bool
$c== :: LiteralVariant -> LiteralVariant -> Bool
Eq, Eq LiteralVariant
LiteralVariant -> LiteralVariant -> Bool
LiteralVariant -> LiteralVariant -> Ordering
LiteralVariant -> LiteralVariant -> LiteralVariant
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: LiteralVariant -> LiteralVariant -> LiteralVariant
$cmin :: LiteralVariant -> LiteralVariant -> LiteralVariant
max :: LiteralVariant -> LiteralVariant -> LiteralVariant
$cmax :: LiteralVariant -> LiteralVariant -> LiteralVariant
>= :: LiteralVariant -> LiteralVariant -> Bool
$c>= :: LiteralVariant -> LiteralVariant -> Bool
> :: LiteralVariant -> LiteralVariant -> Bool
$c> :: LiteralVariant -> LiteralVariant -> Bool
<= :: LiteralVariant -> LiteralVariant -> Bool
$c<= :: LiteralVariant -> LiteralVariant -> Bool
< :: LiteralVariant -> LiteralVariant -> Bool
$c< :: LiteralVariant -> LiteralVariant -> Bool
compare :: LiteralVariant -> LiteralVariant -> Ordering
$ccompare :: LiteralVariant -> LiteralVariant -> Ordering
Ord, ReadPrec [LiteralVariant]
ReadPrec LiteralVariant
Int -> ReadS LiteralVariant
ReadS [LiteralVariant]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LiteralVariant]
$creadListPrec :: ReadPrec [LiteralVariant]
readPrec :: ReadPrec LiteralVariant
$creadPrec :: ReadPrec LiteralVariant
readList :: ReadS [LiteralVariant]
$creadList :: ReadS [LiteralVariant]
readsPrec :: Int -> ReadS LiteralVariant
$creadsPrec :: Int -> ReadS LiteralVariant
Read, Int -> LiteralVariant -> ShowS
[LiteralVariant] -> ShowS
LiteralVariant -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LiteralVariant] -> ShowS
$cshowList :: [LiteralVariant] -> ShowS
show :: LiteralVariant -> String
$cshow :: LiteralVariant -> String
showsPrec :: Int -> LiteralVariant -> ShowS
$cshowsPrec :: Int -> LiteralVariant -> ShowS
Show)

_LiteralVariant :: Name
_LiteralVariant = (String -> Name
Core.Name String
"hydra/mantle.LiteralVariant")

_LiteralVariant_binary :: FieldName
_LiteralVariant_binary = (String -> FieldName
Core.FieldName String
"binary")

_LiteralVariant_boolean :: FieldName
_LiteralVariant_boolean = (String -> FieldName
Core.FieldName String
"boolean")

_LiteralVariant_float :: FieldName
_LiteralVariant_float = (String -> FieldName
Core.FieldName String
"float")

_LiteralVariant_integer :: FieldName
_LiteralVariant_integer = (String -> FieldName
Core.FieldName String
"integer")

_LiteralVariant_string :: FieldName
_LiteralVariant_string = (String -> FieldName
Core.FieldName String
"string")

-- | Numeric precision: arbitrary precision, or precision to a specified number of bits
data Precision = 
  PrecisionArbitrary  |
  PrecisionBits Int
  deriving (Precision -> Precision -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Precision -> Precision -> Bool
$c/= :: Precision -> Precision -> Bool
== :: Precision -> Precision -> Bool
$c== :: Precision -> Precision -> Bool
Eq, Eq Precision
Precision -> Precision -> Bool
Precision -> Precision -> Ordering
Precision -> Precision -> Precision
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Precision -> Precision -> Precision
$cmin :: Precision -> Precision -> Precision
max :: Precision -> Precision -> Precision
$cmax :: Precision -> Precision -> Precision
>= :: Precision -> Precision -> Bool
$c>= :: Precision -> Precision -> Bool
> :: Precision -> Precision -> Bool
$c> :: Precision -> Precision -> Bool
<= :: Precision -> Precision -> Bool
$c<= :: Precision -> Precision -> Bool
< :: Precision -> Precision -> Bool
$c< :: Precision -> Precision -> Bool
compare :: Precision -> Precision -> Ordering
$ccompare :: Precision -> Precision -> Ordering
Ord, ReadPrec [Precision]
ReadPrec Precision
Int -> ReadS Precision
ReadS [Precision]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Precision]
$creadListPrec :: ReadPrec [Precision]
readPrec :: ReadPrec Precision
$creadPrec :: ReadPrec Precision
readList :: ReadS [Precision]
$creadList :: ReadS [Precision]
readsPrec :: Int -> ReadS Precision
$creadsPrec :: Int -> ReadS Precision
Read, Int -> Precision -> ShowS
[Precision] -> ShowS
Precision -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Precision] -> ShowS
$cshowList :: [Precision] -> ShowS
show :: Precision -> String
$cshow :: Precision -> String
showsPrec :: Int -> Precision -> ShowS
$cshowsPrec :: Int -> Precision -> ShowS
Show)

_Precision :: Name
_Precision = (String -> Name
Core.Name String
"hydra/mantle.Precision")

_Precision_arbitrary :: FieldName
_Precision_arbitrary = (String -> FieldName
Core.FieldName String
"arbitrary")

_Precision_bits :: FieldName
_Precision_bits = (String -> FieldName
Core.FieldName String
"bits")

-- | The identifier of a term expression constructor
data TermVariant = 
  TermVariantAnnotated  |
  TermVariantApplication  |
  TermVariantElement  |
  TermVariantFunction  |
  TermVariantLet  |
  TermVariantList  |
  TermVariantLiteral  |
  TermVariantMap  |
  TermVariantNominal  |
  TermVariantOptional  |
  TermVariantProduct  |
  TermVariantRecord  |
  TermVariantSet  |
  TermVariantStream  |
  TermVariantSum  |
  TermVariantUnion  |
  TermVariantVariable 
  deriving (TermVariant -> TermVariant -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TermVariant -> TermVariant -> Bool
$c/= :: TermVariant -> TermVariant -> Bool
== :: TermVariant -> TermVariant -> Bool
$c== :: TermVariant -> TermVariant -> Bool
Eq, Eq TermVariant
TermVariant -> TermVariant -> Bool
TermVariant -> TermVariant -> Ordering
TermVariant -> TermVariant -> TermVariant
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TermVariant -> TermVariant -> TermVariant
$cmin :: TermVariant -> TermVariant -> TermVariant
max :: TermVariant -> TermVariant -> TermVariant
$cmax :: TermVariant -> TermVariant -> TermVariant
>= :: TermVariant -> TermVariant -> Bool
$c>= :: TermVariant -> TermVariant -> Bool
> :: TermVariant -> TermVariant -> Bool
$c> :: TermVariant -> TermVariant -> Bool
<= :: TermVariant -> TermVariant -> Bool
$c<= :: TermVariant -> TermVariant -> Bool
< :: TermVariant -> TermVariant -> Bool
$c< :: TermVariant -> TermVariant -> Bool
compare :: TermVariant -> TermVariant -> Ordering
$ccompare :: TermVariant -> TermVariant -> Ordering
Ord, ReadPrec [TermVariant]
ReadPrec TermVariant
Int -> ReadS TermVariant
ReadS [TermVariant]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TermVariant]
$creadListPrec :: ReadPrec [TermVariant]
readPrec :: ReadPrec TermVariant
$creadPrec :: ReadPrec TermVariant
readList :: ReadS [TermVariant]
$creadList :: ReadS [TermVariant]
readsPrec :: Int -> ReadS TermVariant
$creadsPrec :: Int -> ReadS TermVariant
Read, Int -> TermVariant -> ShowS
[TermVariant] -> ShowS
TermVariant -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TermVariant] -> ShowS
$cshowList :: [TermVariant] -> ShowS
show :: TermVariant -> String
$cshow :: TermVariant -> String
showsPrec :: Int -> TermVariant -> ShowS
$cshowsPrec :: Int -> TermVariant -> ShowS
Show)

_TermVariant :: Name
_TermVariant = (String -> Name
Core.Name String
"hydra/mantle.TermVariant")

_TermVariant_annotated :: FieldName
_TermVariant_annotated = (String -> FieldName
Core.FieldName String
"annotated")

_TermVariant_application :: FieldName
_TermVariant_application = (String -> FieldName
Core.FieldName String
"application")

_TermVariant_element :: FieldName
_TermVariant_element = (String -> FieldName
Core.FieldName String
"element")

_TermVariant_function :: FieldName
_TermVariant_function = (String -> FieldName
Core.FieldName String
"function")

_TermVariant_let :: FieldName
_TermVariant_let = (String -> FieldName
Core.FieldName String
"let")

_TermVariant_list :: FieldName
_TermVariant_list = (String -> FieldName
Core.FieldName String
"list")

_TermVariant_literal :: FieldName
_TermVariant_literal = (String -> FieldName
Core.FieldName String
"literal")

_TermVariant_map :: FieldName
_TermVariant_map = (String -> FieldName
Core.FieldName String
"map")

_TermVariant_nominal :: FieldName
_TermVariant_nominal = (String -> FieldName
Core.FieldName String
"nominal")

_TermVariant_optional :: FieldName
_TermVariant_optional = (String -> FieldName
Core.FieldName String
"optional")

_TermVariant_product :: FieldName
_TermVariant_product = (String -> FieldName
Core.FieldName String
"product")

_TermVariant_record :: FieldName
_TermVariant_record = (String -> FieldName
Core.FieldName String
"record")

_TermVariant_set :: FieldName
_TermVariant_set = (String -> FieldName
Core.FieldName String
"set")

_TermVariant_stream :: FieldName
_TermVariant_stream = (String -> FieldName
Core.FieldName String
"stream")

_TermVariant_sum :: FieldName
_TermVariant_sum = (String -> FieldName
Core.FieldName String
"sum")

_TermVariant_union :: FieldName
_TermVariant_union = (String -> FieldName
Core.FieldName String
"union")

_TermVariant_variable :: FieldName
_TermVariant_variable = (String -> FieldName
Core.FieldName String
"variable")

-- | A type expression together with free type variables occurring in the expression
data TypeScheme m = 
  TypeScheme {
    forall m. TypeScheme m -> [VariableType]
typeSchemeVariables :: [Core.VariableType],
    forall m. TypeScheme m -> Type m
typeSchemeType :: (Core.Type m)}
  deriving (TypeScheme m -> TypeScheme m -> Bool
forall m. Eq m => TypeScheme m -> TypeScheme m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypeScheme m -> TypeScheme m -> Bool
$c/= :: forall m. Eq m => TypeScheme m -> TypeScheme m -> Bool
== :: TypeScheme m -> TypeScheme m -> Bool
$c== :: forall m. Eq m => TypeScheme m -> TypeScheme m -> Bool
Eq, TypeScheme m -> TypeScheme m -> Bool
TypeScheme m -> TypeScheme m -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {m}. Ord m => Eq (TypeScheme m)
forall m. Ord m => TypeScheme m -> TypeScheme m -> Bool
forall m. Ord m => TypeScheme m -> TypeScheme m -> Ordering
forall m. Ord m => TypeScheme m -> TypeScheme m -> TypeScheme m
min :: TypeScheme m -> TypeScheme m -> TypeScheme m
$cmin :: forall m. Ord m => TypeScheme m -> TypeScheme m -> TypeScheme m
max :: TypeScheme m -> TypeScheme m -> TypeScheme m
$cmax :: forall m. Ord m => TypeScheme m -> TypeScheme m -> TypeScheme m
>= :: TypeScheme m -> TypeScheme m -> Bool
$c>= :: forall m. Ord m => TypeScheme m -> TypeScheme m -> Bool
> :: TypeScheme m -> TypeScheme m -> Bool
$c> :: forall m. Ord m => TypeScheme m -> TypeScheme m -> Bool
<= :: TypeScheme m -> TypeScheme m -> Bool
$c<= :: forall m. Ord m => TypeScheme m -> TypeScheme m -> Bool
< :: TypeScheme m -> TypeScheme m -> Bool
$c< :: forall m. Ord m => TypeScheme m -> TypeScheme m -> Bool
compare :: TypeScheme m -> TypeScheme m -> Ordering
$ccompare :: forall m. Ord m => TypeScheme m -> TypeScheme m -> Ordering
Ord, ReadPrec [TypeScheme m]
ReadPrec (TypeScheme m)
ReadS [TypeScheme m]
forall m. Read m => ReadPrec [TypeScheme m]
forall m. Read m => ReadPrec (TypeScheme m)
forall m. Read m => Int -> ReadS (TypeScheme m)
forall m. Read m => ReadS [TypeScheme m]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypeScheme m]
$creadListPrec :: forall m. Read m => ReadPrec [TypeScheme m]
readPrec :: ReadPrec (TypeScheme m)
$creadPrec :: forall m. Read m => ReadPrec (TypeScheme m)
readList :: ReadS [TypeScheme m]
$creadList :: forall m. Read m => ReadS [TypeScheme m]
readsPrec :: Int -> ReadS (TypeScheme m)
$creadsPrec :: forall m. Read m => Int -> ReadS (TypeScheme m)
Read, Int -> TypeScheme m -> ShowS
forall m. Show m => Int -> TypeScheme m -> ShowS
forall m. Show m => [TypeScheme m] -> ShowS
forall m. Show m => TypeScheme m -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypeScheme m] -> ShowS
$cshowList :: forall m. Show m => [TypeScheme m] -> ShowS
show :: TypeScheme m -> String
$cshow :: forall m. Show m => TypeScheme m -> String
showsPrec :: Int -> TypeScheme m -> ShowS
$cshowsPrec :: forall m. Show m => Int -> TypeScheme m -> ShowS
Show)

_TypeScheme :: Name
_TypeScheme = (String -> Name
Core.Name String
"hydra/mantle.TypeScheme")

_TypeScheme_variables :: FieldName
_TypeScheme_variables = (String -> FieldName
Core.FieldName String
"variables")

_TypeScheme_type :: FieldName
_TypeScheme_type = (String -> FieldName
Core.FieldName String
"type")

-- | The identifier of a type constructor
data TypeVariant = 
  TypeVariantAnnotated  |
  TypeVariantApplication  |
  TypeVariantElement  |
  TypeVariantFunction  |
  TypeVariantLambda  |
  TypeVariantList  |
  TypeVariantLiteral  |
  TypeVariantMap  |
  TypeVariantNominal  |
  TypeVariantOptional  |
  TypeVariantProduct  |
  TypeVariantRecord  |
  TypeVariantSet  |
  TypeVariantStream  |
  TypeVariantSum  |
  TypeVariantUnion  |
  TypeVariantVariable 
  deriving (TypeVariant -> TypeVariant -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypeVariant -> TypeVariant -> Bool
$c/= :: TypeVariant -> TypeVariant -> Bool
== :: TypeVariant -> TypeVariant -> Bool
$c== :: TypeVariant -> TypeVariant -> Bool
Eq, Eq TypeVariant
TypeVariant -> TypeVariant -> Bool
TypeVariant -> TypeVariant -> Ordering
TypeVariant -> TypeVariant -> TypeVariant
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TypeVariant -> TypeVariant -> TypeVariant
$cmin :: TypeVariant -> TypeVariant -> TypeVariant
max :: TypeVariant -> TypeVariant -> TypeVariant
$cmax :: TypeVariant -> TypeVariant -> TypeVariant
>= :: TypeVariant -> TypeVariant -> Bool
$c>= :: TypeVariant -> TypeVariant -> Bool
> :: TypeVariant -> TypeVariant -> Bool
$c> :: TypeVariant -> TypeVariant -> Bool
<= :: TypeVariant -> TypeVariant -> Bool
$c<= :: TypeVariant -> TypeVariant -> Bool
< :: TypeVariant -> TypeVariant -> Bool
$c< :: TypeVariant -> TypeVariant -> Bool
compare :: TypeVariant -> TypeVariant -> Ordering
$ccompare :: TypeVariant -> TypeVariant -> Ordering
Ord, ReadPrec [TypeVariant]
ReadPrec TypeVariant
Int -> ReadS TypeVariant
ReadS [TypeVariant]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypeVariant]
$creadListPrec :: ReadPrec [TypeVariant]
readPrec :: ReadPrec TypeVariant
$creadPrec :: ReadPrec TypeVariant
readList :: ReadS [TypeVariant]
$creadList :: ReadS [TypeVariant]
readsPrec :: Int -> ReadS TypeVariant
$creadsPrec :: Int -> ReadS TypeVariant
Read, Int -> TypeVariant -> ShowS
[TypeVariant] -> ShowS
TypeVariant -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypeVariant] -> ShowS
$cshowList :: [TypeVariant] -> ShowS
show :: TypeVariant -> String
$cshow :: TypeVariant -> String
showsPrec :: Int -> TypeVariant -> ShowS
$cshowsPrec :: Int -> TypeVariant -> ShowS
Show)

_TypeVariant :: Name
_TypeVariant = (String -> Name
Core.Name String
"hydra/mantle.TypeVariant")

_TypeVariant_annotated :: FieldName
_TypeVariant_annotated = (String -> FieldName
Core.FieldName String
"annotated")

_TypeVariant_application :: FieldName
_TypeVariant_application = (String -> FieldName
Core.FieldName String
"application")

_TypeVariant_element :: FieldName
_TypeVariant_element = (String -> FieldName
Core.FieldName String
"element")

_TypeVariant_function :: FieldName
_TypeVariant_function = (String -> FieldName
Core.FieldName String
"function")

_TypeVariant_lambda :: FieldName
_TypeVariant_lambda = (String -> FieldName
Core.FieldName String
"lambda")

_TypeVariant_list :: FieldName
_TypeVariant_list = (String -> FieldName
Core.FieldName String
"list")

_TypeVariant_literal :: FieldName
_TypeVariant_literal = (String -> FieldName
Core.FieldName String
"literal")

_TypeVariant_map :: FieldName
_TypeVariant_map = (String -> FieldName
Core.FieldName String
"map")

_TypeVariant_nominal :: FieldName
_TypeVariant_nominal = (String -> FieldName
Core.FieldName String
"nominal")

_TypeVariant_optional :: FieldName
_TypeVariant_optional = (String -> FieldName
Core.FieldName String
"optional")

_TypeVariant_product :: FieldName
_TypeVariant_product = (String -> FieldName
Core.FieldName String
"product")

_TypeVariant_record :: FieldName
_TypeVariant_record = (String -> FieldName
Core.FieldName String
"record")

_TypeVariant_set :: FieldName
_TypeVariant_set = (String -> FieldName
Core.FieldName String
"set")

_TypeVariant_stream :: FieldName
_TypeVariant_stream = (String -> FieldName
Core.FieldName String
"stream")

_TypeVariant_sum :: FieldName
_TypeVariant_sum = (String -> FieldName
Core.FieldName String
"sum")

_TypeVariant_union :: FieldName
_TypeVariant_union = (String -> FieldName
Core.FieldName String
"union")

_TypeVariant_variable :: FieldName
_TypeVariant_variable = (String -> FieldName
Core.FieldName String
"variable")

-- | A type together with an instance of the type
data TypedTerm m = 
  TypedTerm {
    forall m. TypedTerm m -> Type m
typedTermType :: (Core.Type m),
    forall m. TypedTerm m -> Term m
typedTermTerm :: (Core.Term m)}
  deriving (TypedTerm m -> TypedTerm m -> Bool
forall m. Eq m => TypedTerm m -> TypedTerm m -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypedTerm m -> TypedTerm m -> Bool
$c/= :: forall m. Eq m => TypedTerm m -> TypedTerm m -> Bool
== :: TypedTerm m -> TypedTerm m -> Bool
$c== :: forall m. Eq m => TypedTerm m -> TypedTerm m -> Bool
Eq, TypedTerm m -> TypedTerm m -> Bool
TypedTerm m -> TypedTerm m -> Ordering
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {m}. Ord m => Eq (TypedTerm m)
forall m. Ord m => TypedTerm m -> TypedTerm m -> Bool
forall m. Ord m => TypedTerm m -> TypedTerm m -> Ordering
forall m. Ord m => TypedTerm m -> TypedTerm m -> TypedTerm m
min :: TypedTerm m -> TypedTerm m -> TypedTerm m
$cmin :: forall m. Ord m => TypedTerm m -> TypedTerm m -> TypedTerm m
max :: TypedTerm m -> TypedTerm m -> TypedTerm m
$cmax :: forall m. Ord m => TypedTerm m -> TypedTerm m -> TypedTerm m
>= :: TypedTerm m -> TypedTerm m -> Bool
$c>= :: forall m. Ord m => TypedTerm m -> TypedTerm m -> Bool
> :: TypedTerm m -> TypedTerm m -> Bool
$c> :: forall m. Ord m => TypedTerm m -> TypedTerm m -> Bool
<= :: TypedTerm m -> TypedTerm m -> Bool
$c<= :: forall m. Ord m => TypedTerm m -> TypedTerm m -> Bool
< :: TypedTerm m -> TypedTerm m -> Bool
$c< :: forall m. Ord m => TypedTerm m -> TypedTerm m -> Bool
compare :: TypedTerm m -> TypedTerm m -> Ordering
$ccompare :: forall m. Ord m => TypedTerm m -> TypedTerm m -> Ordering
Ord, ReadPrec [TypedTerm m]
ReadPrec (TypedTerm m)
ReadS [TypedTerm m]
forall m. (Read m, Ord m) => ReadPrec [TypedTerm m]
forall m. (Read m, Ord m) => ReadPrec (TypedTerm m)
forall m. (Read m, Ord m) => Int -> ReadS (TypedTerm m)
forall m. (Read m, Ord m) => ReadS [TypedTerm m]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypedTerm m]
$creadListPrec :: forall m. (Read m, Ord m) => ReadPrec [TypedTerm m]
readPrec :: ReadPrec (TypedTerm m)
$creadPrec :: forall m. (Read m, Ord m) => ReadPrec (TypedTerm m)
readList :: ReadS [TypedTerm m]
$creadList :: forall m. (Read m, Ord m) => ReadS [TypedTerm m]
readsPrec :: Int -> ReadS (TypedTerm m)
$creadsPrec :: forall m. (Read m, Ord m) => Int -> ReadS (TypedTerm m)
Read, Int -> TypedTerm m -> ShowS
forall m. Show m => Int -> TypedTerm m -> ShowS
forall m. Show m => [TypedTerm m] -> ShowS
forall m. Show m => TypedTerm m -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypedTerm m] -> ShowS
$cshowList :: forall m. Show m => [TypedTerm m] -> ShowS
show :: TypedTerm m -> String
$cshow :: forall m. Show m => TypedTerm m -> String
showsPrec :: Int -> TypedTerm m -> ShowS
$cshowsPrec :: forall m. Show m => Int -> TypedTerm m -> ShowS
Show)

_TypedTerm :: Name
_TypedTerm = (String -> Name
Core.Name String
"hydra/mantle.TypedTerm")

_TypedTerm_type :: FieldName
_TypedTerm_type = (String -> FieldName
Core.FieldName String
"type")

_TypedTerm_term :: FieldName
_TypedTerm_term = (String -> FieldName
Core.FieldName String
"term")