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

FStar doesn't have phantom types #1492

Closed
theolaurent opened this issue Jul 8, 2018 · 3 comments
Closed

FStar doesn't have phantom types #1492

theolaurent opened this issue Jul 8, 2018 · 3 comments

Comments

@theolaurent
Copy link

According to the Haskell Wiki:

A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition

In FStar, type parameters are added as regular implicits arguments of the type constructors (for example, on can project them). So morally, they do appear on the right-hand side. This is mentioned by @kyoDralliam in #65.

I don't know if lack of phantom types is such an issue, but it seems like a weird setting to me. Anyway as projecting type parameters from constructors is about to be forbidden (fix for #65), opening this issue for discussion.

Question: maybe we shouldn't carry them around at all?

@theolaurent
Copy link
Author

Or maybe it is just enough to forbid matching? How does it work in Coq for example?

@A-Manning
Copy link
Contributor

IIRC type parameters index constructors, but you can get an erased parameter like so:

type notPhantom (a: Type) =
    | NotPhantom

type phantom (a: Type) (b: Type) = notPhantom a

@nikswamy
Copy link
Collaborator

Closing this issue. A-Manning's response still looks pretty good to me.

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

3 participants