hsass-0.4.0: Integrating Sass into Haskell applications.

Safe HaskellSafe
LanguageHaskell2010

Text.Sass.Utils

Contents

Description

Helper functions. This module is internal and should not be used in production code.

Synopsis

Interoperation with C API

withOptionalCString :: Maybe String -> (CString -> IO ()) -> IO () Source

withOptionalCString str action, if str is Nothing, action is not invoked, otherwise behaves like withCString.

listEntryNotNull :: (Monad m, MonadIO m) => StateT (Ptr (Ptr a)) m Bool Source

Checks if the pointer in state points to non-null location.

loopCList :: (Monad m, MonadIO m) => (Ptr a -> m ()) -> Ptr (Ptr a) -> m () Source

loopCArray action list calls action over each element of list that is C array with NULL signifying end of array.

copyToCList Source

Arguments

:: (Num size, Enum size) 
=> (CSize -> IO list)

List creator.

-> (a -> IO element)

Conversion function.

-> (list -> size -> element -> IO ())

Set element function.

-> [a]

Elements.

-> IO list 

Copies converted list of elements to new C array.

Other helpers

concatPaths :: [FilePath] -> FilePath Source

Concatenates list of paths, separating entries with appropriate character.

arrayRange :: (Num a, Integral a, Enum a) => a -> [a] Source

Generates array indices for array of specified length.