-
Notifications
You must be signed in to change notification settings - Fork 57
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
First class byte array support #378
Comments
A few years ago, I've helped making a port of Coq's formalized binary arithmetic here: https://github.com/sbp/idris-bi. This includes both unbounded and bounded inductively defined binaries. The original Coq library is used in CompCert verified C compiler. One standing problem with that library is that there's no way to implement an analogue of a "nat hack", i.e. a compiler optimization mapping these transparently to machine words. I think after adding a "bin hack", |
|
Yes, you can make a |
For example, if I want to prove that a function returns a well-typed output on any file. What should the input type be?
Data.Buffer
has IO interface and can't be pattern matched on.String
can't handle arbitrary bytes and doesn't allow to pattern match on individual bytes. I could useList
, but it seems that there is no type for a byte either. If I useList (Fin 256)
, will the performance be reasonable?Without a good way to work with bytes, I struggle to find any practical application for Idris. Almost any program has to work with bytes because a program would be useless without interacting with files or network. Working with compressed data (images, video), any binary file formats (like protobuf) is impossible.
Are there any workarounds I'm not aware of? I found the following:
Data.Buffer
as the suggested way to do it;String
.The text was updated successfully, but these errors were encountered: