Skip to content

typelevel dependency #29

Closed
Closed

Description

@jamesdbrock

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?

Activity

  1. jamesdbrock commented on Jun 19, 2021

    @jamesdbrock
    MemberAuthor

    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.

  2. jamesdbrock commented on Jul 16, 2021

    @jamesdbrock
    MemberAuthor

    Resolved in v11.0.0 .

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions