Skip to content

Swap genShortByteString for genByteArray #142

@Bodigrim

Description

@Bodigrim

Since bytestring-0.12 ShortByteString is just a newtype over ByteArray, a common data type shared by base, text and primitive.

I think we can make class Random more useful if we swap

-genShortByteString :: Int -> g -> (ShortByteString, g)
+genByteArray Int -> g -> (ByteArray, g) 

This way we can shave off dependency on bytestring and do not impose it on our users.

There does not seem to be many users of genShortByteString in the wild. Potentially we can provide a compatibility shim:

genShortByteString :: Coercible a ByteArray => Int -> g -> (a, g)
genShortByteString = coerce genByteArray

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