Use Opaque over Alias

This commit is contained in:
Richard Feldman 2022-07-15 17:13:46 -04:00 committed by Ayaz Hafiz
parent 73cd5b8c7c
commit c859ce0b23
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 90 additions and 14 deletions

View file

@ -4,6 +4,7 @@ use crate::subs::{
GetSubsSlice, RecordFields, Subs, UnionTags, VarStore, Variable, VariableSubsSlice,
};
use roc_collections::all::{HumanIndex, ImMap, ImSet, MutMap, MutSet, SendMap};
use roc_collections::VecMap;
use roc_error_macros::internal_error;
use roc_module::called_via::CalledVia;
use roc_module::ident::{ForeignSymbol, Ident, Lowercase, TagName};
@ -2055,7 +2056,31 @@ impl From<&AliasVar> for OptAbleVar {
}
}
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug)]
pub struct Opaque {
pub region: Region,
pub type_variables: Vec<Loc<AliasVar>>,
/// lambda set variables, e.g. the one annotating the arrow in
/// a |c|-> b
pub lambda_set_variables: Vec<LambdaSet>,
pub recursion_variables: MutSet<Variable>,
pub typ: Type,
pub kind: AliasKind,
pub supports: Vec<OpaqueSupports>,
}
#[derive(Clone, Debug)]
pub enum OpaqueSupports {
Derived(Symbol),
Implemented {
ability_name: Symbol,
impls: VecMap<Symbol, Symbol>,
},
}
#[derive(Clone, Debug)]
pub struct Alias {
pub region: Region,
pub type_variables: Vec<Loc<AliasVar>>,