You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
length returns a CountOf value, but these seem pretty painful to work with. In some code I'm working with, I need to build a count of bytes to supply to OpenGL. This means multiplying a CountOf by the size in bytes of a single element, and then turning the whole thing to a Int, but there is no easy way to do this (there is no eliminator for CountOf, for one).
The text was updated successfully, but these errors were encountered:
so the idea of CountOf is to be able to distinguish stuff like "a number of a" and "a number of bytes".
The external interface of CountOf is a bit crappy at the moment but I think it has some merits. This found couple of internals bugs at compilation time where the number units had not been converted properly because of using Int before.
Also CountOf doesn't have a IsNegative instance, so you can write negative literal for it, and potentially the type inside could be unsigned in the future, preventing by type to e.g. take -3
I think we just need to put some lipstick on the interfaces (and here suggestions are more than welcome to make it less painful to work with; One of the issue is that the current state of affair (haskell / base) is quite poor in term of integral APIs, so we don't have anything useful to re-use.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
length
returns aCountOf
value, but these seem pretty painful to work with. In some code I'm working with, I need to build a count of bytes to supply to OpenGL. This means multiplying aCountOf
by the size in bytes of a single element, and then turning the whole thing to aInt
, but there is no easy way to do this (there is no eliminator forCountOf
, for one).The text was updated successfully, but these errors were encountered: