Skip to content

more type information for Stream #56

@joeyh

Description

@joeyh

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?

Metadata

Metadata

Labels

duplicateThis issue or pull request already exists

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions