Skip to content

add Data.Text.Foreign.peekCString? #239

@chessai

Description

@chessai

we already have peekCStringLen:

peekCStringLen :: CStringLen -> IO Text
peekCStringLen cs = do
  bs <- unsafePackCStringLen cs
  return $! decodeUtf8 bs

would it make sense to have peekCString?

peekCString :: CString -> IO Text
peekCString cs = do
  bs <- unsafePackCString cs
  return $! decodeUtf8 bs

It just calls a different function from Data.ByteString.Unsafe. It seems like Data.Text.Foreign would be a natural home for this given that peekCStringLen is already there.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions