-
Notifications
You must be signed in to change notification settings - Fork 26
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
Question: Will Sixten support specifying erasure like Idris 2? #148
Comments
I'm not sure. It seems to be more complicated in Sixten because values that are only used in types can not always be erased (when they contribute to type size calculations at runtime). Either way, propositional equality is of size zero, so the equality proof doesn't need to be passed to your function because it doesn't really exist at runtime. |
I'm currently trying to make a red-black tree in Idris, and it's very helpful to know that you can mark data as erased, so that you are sure it's only used for proofs. data Color = Red | Black
data GoodTree :
{height : Nat} ->
{color : Color} ->
{kt : Type} ->
{kord : LawfulOrd kt} ->
{keys : List kt} ->
{vt : kt -> Type} -> Type
where
Empty : GoodTree {height = 0, color = Black, keys = []}
RedNode :
{0 kord : LawfulOrd kt} ->
(k : kt) ->
{0 kp : In (k ==) keys} ->
vt k ->
GoodTree {height, color = Black, kt, kord, keys = filter (k >) keys, vt} ->
GoodTree {height, color = Black, kt, kord, keys = filter (k <) keys, vt} ->
GoodTree {height, color = Red, kt, kord, keys, vt}
BlackNode :
{0 kord : LawfulOrd kt} ->
(k : kt) ->
{0 kp : In (k ==) keys} ->
vt k ->
GoodTree {height, kt, kord, keys = filter (k >) keys, vt} ->
GoodTree {height, kt, kord, keys = filter (k <) keys, vt} ->
GoodTree {height = S height, color = Black, kt, kord, keys, vt} The correctness of the tree depends on the data In : (a -> Bool) -> List a -> Type where
MkIn : (x : a) -> (f x = True) -> (xs : List a) -> In f (x :: xs)
MkInCons : (x : a) -> (xs : List a) -> In f xs -> In f (x :: xs) Without the |
Yeah, I don't have a good answer to this question at the moment. It seems like it would still be useful to have some sort of user specified erasure in Sixten despite e.g. zero sized data. |
Are you planning to support specifying erasure, e.g. like
(0 _ : x = y) -> x -> y
.The text was updated successfully, but these errors were encountered: