uni-util-2.3.0.3: Utilities for the uniform workbench
Safe HaskellNone
LanguageHaskell2010

Util.ICStringLen

Description

This module provides immutable CStrings, which additionally have the property that they are automatically freed when the garbage-collector forgets about them.

Synopsis

Documentation

newtype UTF8 bytes Source #

Constructors

UTF8 bytes 

toUTF8 :: Enum byte => String -> [byte] Source #

Converts a String into its UTF8 representation.

fromUTF8WE :: (Enum byte, MonadFail m) => [byte] -> m String Source #

Converts a UTF8 representation of a String back into the String, catching all possible format errors.

Example: With the Haskell module Control.Monad.Error, you can instance this as (fromUTF8WE :: String -> Either String String) to get a conversion function which either succeeds (Right) or returns an error message (Left).

mkICStringLenExtra :: Int -> (CString -> IO extra) -> IO (ICStringLen, extra) Source #