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

more type information for Stream #56

Closed
joeyh opened this issue Jan 27, 2020 · 2 comments
Closed

more type information for Stream #56

joeyh opened this issue Jan 27, 2020 · 2 comments
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@joeyh
Copy link

joeyh commented Jan 27, 2020

I'm quickly noticing that the low-level C type of a Stream is unsatisfying. It would be really nice to be able to attach my own type information to a Stream, so I can avoid eg, confusing pressure (Stream Float) with temperature (Stream Float).

Using a newtype of Stream is unsatisfactory, because my new type would not be able to be used within expessions in the copilot DSL.

A phantom type seems like a natural approach, eg:

type Stream t = StreamP p t

And change copilot to use StreamP p everywhere it uses Stream currently. Then I could write eg:

emergency_shutdown_required :: StreamP Pressure Float -> StreamP Temperaure Float -> Stream Bool

Would you be open to a change along these lines?

@fdedden fdedden added the enhancement New feature or request label Feb 9, 2020
@fdedden
Copy link
Member

fdedden commented Feb 9, 2020

We have had thoughts about similar ways to make Copilot more type-safe. We will need to discuss this approach and the consequences it has on certain operations (casting of values comes to mind).

In general we are currently focused primarily on making Copilot more stable and mature, but having such a feature extension is definitely interesting for future releases.We will discuss the approach with our next meeting.

Thanks for your suggestion!

@fdedden fdedden added feature request Request or advice for a feature and removed enhancement New feature or request labels Mar 29, 2020
@ivanperez-keera
Copy link
Member

Although the approach is different, this issue is closely related to #58 and solving that one would solve this one too. I'm going to close this one in favor of #58 simply as a way to manage complexity, but this approach may be simpler and easier to start with.

@ivanperez-keera ivanperez-keera added duplicate This issue or pull request already exists and removed feature request Request or advice for a feature labels Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Development

No branches or pull requests

4 participants