PreviousUpNext

15.3.268  src/lib/compiler/front/typer-stuff/types/type-junk.api

## type-junk.api 

# Compiled by:
#     src/lib/compiler/front/typer-stuff/typecheckdata.sublib



stipulate
    package ds  =  deep_syntax;                                         # deep_syntax                   is from   src/lib/compiler/front/typer-stuff/deep-syntax/deep-syntax.pkg
    package id  =  inlining_data;                                       # inlining_data                 is from   src/lib/compiler/front/typer-stuff/basics/inlining-data.pkg
    package ip  =  inverse_path;                                        # inverse_path                  is from   src/lib/compiler/front/typer-stuff/basics/symbol-path.pkg
    package tdt =  type_declaration_types;                              # type_declaration_types        is from   src/lib/compiler/front/typer-stuff/types/type-declaration-types.pkg
    package sy  =  symbol;                                              # symbol                        is from   src/lib/compiler/front/basics/map/symbol.pkg
    package syx =  symbolmapstack;                                      # symbolmapstack                is from   src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg
    package sta =  stamp;                                               # stamp                         is from   src/lib/compiler/front/typer-stuff/basics/stamp.pkg
herein

    api Type_Junk {
        #
        equality_property_to_string:  tdt::e::Is_Eqtype -> String;

        # Operations to build typevars, VARtys:
        #
    # 2009-04-17 CrT: Following is not actually used outside of defining file:
    #    make_meta_typevar:       Int -> tdt::Typevar;
        make_incomplete_record_typevar:   (( List ((sy::Symbol, tdt::Typoid))), Int) -> tdt::Typevar;
        make_user_typevar:  sy::Symbol -> tdt::Typevar;

        make_overloaded_literal_typevar: (tdt::Literal_Kind, line_number_db::Source_Code_Region, List(String)) -> tdt::Typoid;
        make_overloaded_typevar_and_type:  List(String) -> tdt::Typoid;

        make_meta_typevar_and_type:  (Int, List(String)) -> tdt::Typoid;

        name_of_type:      tdt::Type -> sy::Symbol;
        stamp_of_type:     tdt::Type -> sta::Stamp;
        namepath_of_type:  tdt::Type -> ip::Inverse_Path;
        stamppath_of_type: tdt::Type -> stamppath::Stamppath;
        arity_of_type:     tdt::Type -> Int;

        set_typepath:       (tdt::Type, ip::Inverse_Path) -> tdt::Type;
        types_are_equal:     (tdt::Type, tdt::Type) -> Bool;
        make_constructor_typoid: (tdt::Type, List( tdt::Typoid )) -> tdt::Typoid;

        drop_resolved_typevars:  tdt::Typoid -> tdt::Typoid;                            # Reduce   tdt::TYPEVAR_REF (REF (tdt::RESOLVED_TYPEVAR type))   to just   type.
                                                                                        # (A resolved typevar is just a useless indirection which complicates processing.)

        same_typevar_ref:    (tdt::Typevar_Ref, tdt::Typevar_Ref) -> Bool;

        resolve_typevars_to_typescheme_slots:       List( tdt::Typevar_Ref ) -> Void;
        resolve_typevars_to_typescheme_slots_1:     List( tdt::Typevar_Ref ) -> tdt::Typescheme_Eqflags;

        exception BAD_TYPE_REDUCTION;

        # Transform every
        #     TYPCON_TYPE.typ
        # in given type:
        #
        map_constructor_typoid_dot_type
            :
            (tdt::Type -> tdt::Type)    # Transform.
            ->
            tdt::Typoid                                         # Type to transform.
            ->
            tdt::Typoid;

        apply_typescheme:  (tdt::Typescheme, List( tdt::Typoid )) -> tdt::Typoid;

        reduce_typoid:        tdt::Typoid -> tdt::Typoid;
        head_reduce_typoid:   tdt::Typoid -> tdt::Typoid;
        typoids_are_equal:   (tdt::Typoid, tdt::Typoid) -> Bool;

        type_equality:  (tdt::Type, tdt::Type) -> Bool;

        # Making a "generic" copy of a type:
        #
    # 2009-04-17 CrT: Following is never actually used:
    #    make_type_args:  Int -> List( tdt::Typoid );
        make_typeagnostic_api:  Int -> tdt::Typescheme_Eqflags;

        sumtype_to_type:        tdt::Valcon -> tdt::Type;
        sumtype_to_typoid:    (tdt::Type, Null_Or( tdt::Typoid )) -> tdt::Typoid;

        match_typescheme:  (tdt::Typescheme, tdt::Typoid) -> tdt::Typoid;               # Used (only) declaring overloadings in   src/lib/compiler/front/typer/main/type-core-language.pkg

        # Get rid of MACRO_EXPANDED indirections in a type:
        #
        drop_macro_expanded_indirections_from_type:  tdt::Typoid -> Void;  


        instantiate_if_typescheme:  (tdt::Typoid, syx::Symbolmapstack, List(String)) -> (tdt::Typoid, List( tdt::Typoid ));

        pkg_typoid_matches_api_typoid
            :
            { type_per_api:  tdt::Typoid,
              type_per_pkg:  tdt::Typoid
            }
            ->
            Bool; 

        typevar_of_typoid:  tdt::Typoid -> tdt::Typevar_Ref;

        # Check if a bound typevar has occurred in some sumtypes, e::g.  List(X). 
        # this is useful for representation analysis; but it should be 
        # obsolete very soon -- zsh. 
        #
        get_recursive_typevar_map:  (Int, tdt::Typoid) -> (Int -> Bool);
        label_is_greater_than:  (sy::Symbol, sy::Symbol) -> Bool;

        is_value:  { inlining_data_says_it_is_pure:  id::Inlining_Data -> Bool } -> ds::Deep_Expression -> Bool;
        is_variable_typoid:  tdt::Typoid -> Bool;

        sort_fields:   List( (ds::Numbered_Label, X))
                     ->  List( (ds::Numbered_Label, X));

        map_unzip:  (X -> (Y, Z)) -> List(X) -> (List(Y), List(Z));

        Typeset;

        make_typeset:      Void -> Typeset;
        insert_type_into_typeset:  (tdt::Type, Typeset) -> Typeset;
        filter_typeset:    (tdt::Typoid, Typeset) -> List( tdt::Type );

        sumtype_sibling:    (Int, tdt::Type) -> tdt::Type;
        extract_sumtype: tdt::Type -> List( tdt::Valcon );

        wrap_definition:  (tdt::Type, sta::Stamp) -> tdt::Type;

           # make a typ into a DEFINED_TYP by "eta-expanding" if necessary

        unwrap_definition_1:     tdt::Type -> Null_Or( tdt::Type );
        unwrap_definition_star:  tdt::Type -> tdt::Type;

    };  #  Api Type_Junk 
end;

## Copyright 1996 by AT&T Bell Laboratories 
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext