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

typelevel dependency #29

Closed
jamesdbrock opened this issue Jun 19, 2021 · 2 comments
Closed

typelevel dependency #29

jamesdbrock opened this issue Jun 19, 2021 · 2 comments

Comments

@jamesdbrock
Copy link
Member

For moving this package to purescript-contrib, @thomashoneyman has requested that the package has no dependencies outside of purescript-contrib, and the purescript-typelevel package does not belong to purescript-contrib.

The BytesPerValue class with the dependency on purescript-typelevel was introduced in this redesign by @athanclark .

#23

Do you have any advice about this @jacereda @athanclark ? How would you approach this?

@jamesdbrock
Copy link
Member Author

jamesdbrock commented Jun 19, 2021

From purescript-typelevel we only use the toInt' method of the Nat class on types D1, D2, D4, and D8.

Here's one thing which I think we could do which I think would completely eliminate the need for purescript-typelevel.

We could replace the BytesPerValue typeclass with something like this:

class BytesPerType (a :: ArrayViewType) where
  byteSize :: (Proxy a) -> Int

instance bytesPerTypeInt8 :: BytesPerType Int8 where byteSize _ = 1
instance bytesPerTypeInt16 :: BytesPerType Int16 where byteSize _ = 2

Then we would also be able to remove the Nat type constraint on a lot of public API functions, which would be a win in my opinion.

@jamesdbrock
Copy link
Member Author

Resolved in v11.0.0 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant