expose strlen from Foreign.C.String

chessai chessai1996 at gmail.com
Wed Jan 20 17:54:30 UTC 2021


I've wanted the following before:

foreign import ccall unsafe "strlen"
  cstringLength# :: Addr# -> Int#

cstringLength :: CString -> Int
cstringLength (Ptr s) = I# (cstringLength# s)

A natural place for this seems to be Foreign.C.String.

Thoughts?


More information about the Libraries mailing list