StructuralInference
Implements type inference for unstructured documents like XML or JSON
Functions and values
Function or value | Description |
getInferedTypeFromString (...)
Signature: cultureInfo:CultureInfo -> value:string -> unit:Type option -> InferedType
|
Infers the type of a simple string value
|
inferCollectionType (...)
Signature: allowEmptyValues:bool -> types:seq<InferedType> -> InferedType
|
Infer the type of the collection based on multiple sample types
(group the types by tag, count their multiplicity)
|
inferPrimitiveType cultureInfo value
Signature: cultureInfo:CultureInfo -> value:string -> Type
|
Infers the type of a simple string value
Returns one of null|typeof|typeof|typeof|typeof|typeof|typeof|typeof|typeof|typeof|typeof
|
subtypeInfered allowEmptyValues ot1 ot2
Signature: allowEmptyValues:bool -> ot1:InferedType -> ot2:InferedType -> InferedType
|
Find common subtype of two infered types:
- If the types are both primitive, then we find common subtype of the primitive types
- If the types are both records, then we union their fields (and mark some as optional)
- If the types are both collections, then we take subtype of their elements
(note we do not generate heterogeneous types in this case!)
- If one type is the Top type, then we return the other without checking
- If one of the types is the Null type and the other is not a value type
(numbers or booleans, but not string) then we return the other type.
Otherwise, we return bottom.
The contract that should hold about the function is that given two types with the
same InferedTypeTag , the result also has the same InferedTypeTag .
|
supportsUnitsOfMeasure typ
Signature: typ:Type -> bool
|
Checks whether a type supports unit of measure
|
typeTag _arg1
Signature: _arg1:InferedType -> InferedTypeTag
|
Returns a tag of a type - a tag represents a 'kind' of type
(essentially it describes the different bottom types we have)
|
unionRecordTypes allowEmptyValues t1 t2
Signature: allowEmptyValues:bool -> t1:InferedProperty list -> t2:InferedProperty list -> InferedProperty list
|
Get the union of record types (merge their properties)
This matches the corresponding members and marks them as Optional
if one may be missing. It also returns subtype of their types.
|