-module(graded@internal@types). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/graded/internal/types.gleam"). -export([is_subset/2, union/2, empty/0, from_labels/1]). -export_type([qualified_name/0, annotation_kind/0, effect_set/0, param_bound/0, effect_annotation/0, graded_line/0, graded_file/0, resolved_call/0, local_call/0, field_call/0, type_field_annotation/0, external_target/0, external_annotation/0, violation/0, warning/0, check_result/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC(false). -type qualified_name() :: {qualified_name, binary(), binary()}. -type annotation_kind() :: effects | check. -type effect_set() :: wildcard | {specific, gleam@set:set(binary())}. -type param_bound() :: {param_bound, binary(), effect_set()}. -type effect_annotation() :: {effect_annotation, annotation_kind(), binary(), list(param_bound()), effect_set()}. -type graded_line() :: {annotation_line, effect_annotation()} | {type_field_line, type_field_annotation()} | {external_line, external_annotation()} | {comment_line, binary()} | blank_line. -type graded_file() :: {graded_file, list(graded_line())}. -type resolved_call() :: {resolved_call, qualified_name(), glance:span()}. -type local_call() :: {local_call, binary(), glance:span()}. -type field_call() :: {field_call, binary(), binary(), glance:span()}. -type type_field_annotation() :: {type_field_annotation, binary(), binary(), effect_set()}. -type external_target() :: module_external | {function_external, binary()}. -type external_annotation() :: {external_annotation, binary(), external_target(), effect_set()}. -type violation() :: {violation, binary(), qualified_name(), glance:span(), effect_set(), effect_set()}. -type warning() :: {untracked_effect_warning, binary(), qualified_name(), glance:span(), effect_set()}. -type check_result() :: {check_result, binary(), list(violation()), list(warning())}. -file("src/graded/internal/types.gleam", 30). ?DOC(false). -spec is_subset(effect_set(), effect_set()) -> boolean(). is_subset(Actual, Declared) -> case Declared of wildcard -> true; {specific, D} -> case Actual of wildcard -> false; {specific, A} -> gleam@set:is_subset(A, D) end end. -file("src/graded/internal/types.gleam", 42). ?DOC(false). -spec union(effect_set(), effect_set()) -> effect_set(). union(A, B) -> case {A, B} of {wildcard, _} -> wildcard; {_, wildcard} -> wildcard; {{specific, X}, {specific, Y}} -> {specific, gleam@set:union(X, Y)} end. -file("src/graded/internal/types.gleam", 51). ?DOC(false). -spec empty() -> effect_set(). empty() -> {specific, gleam@set:new()}. -file("src/graded/internal/types.gleam", 56). ?DOC(false). -spec from_labels(list(binary())) -> effect_set(). from_labels(Labels) -> {specific, gleam@set:from_list(Labels)}.