Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Types #303

Open
AshleyYakeley opened this issue Aug 5, 2024 · 0 comments
Open

Open Types #303

AshleyYakeley opened this issue Aug 5, 2024 · 0 comments
Milestone

Comments

@AshleyYakeley
Copy link
Owner

AshleyYakeley commented Aug 5, 2024

Type

opentype T;
namespace T of
constructor Int: Integer -> T;
constructor Other: Bool -> Unit -> T;
end;

Storability

Probably shouldn't allow storable, because:

let
opentype storable S;
c = cell @S !"s" ?store;
(m,checkM) = let
        constructor M: S !"M";
        m: S = M;
        checkM: S -> Bool = match M => True; _ => False; end;
    in (m,checkM);
in do
    c := m;
    found <- get c;
    pure $ checkM found
    end;

Parameters

opentype T +a;
namespace T of
constructor This: Maybe a -> T a;
constructor That: a -> T a;
end;

GADTs

Allowed?

opentype T +a;
namespace T of
constructor IsInt: T Integer;  # allowed?
end;

Int.T: T Integer;
fn Int.T => (): T Integer -> Unit;  # wrong as GADT

GADTs might be possible, save for another issue.

Prereq

@AshleyYakeley AshleyYakeley added this to the 0.6 milestone Aug 5, 2024
@AshleyYakeley AshleyYakeley modified the milestones: 0.6, 0.7 Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant