haskus-utils-compat-1.1: Compatibility modules with other external packages (ByteString, etc.)

Safe HaskellNone
LanguageHaskell2010

Haskus.Utils.Embed.ByteString

Description

Embed files as ByteStrings into an executable

Synopsis

Documentation

bufferToByteString :: Buffer mut pin NotFinalized External -> ByteString Source #

Convert an external buffer into a ByteString (O(1))

embedBS :: ByteString -> Q Exp Source #

Embed a ByteString into an executable

embedBSFile :: FilePath -> Q Exp Source #

Embed a single file in your source code.

import qualified Data.ByteString

myFile :: Data.ByteString.ByteString
myFile = $(embedFile "dirName/fileName")

embedBSOneFileOf :: [FilePath] -> Q Exp Source #

Embed a single existing file in your source code out of list a list of paths supplied.

import qualified Data.ByteString

myFile :: Data.ByteString.ByteString
myFile = $(embedOneFileOf [ "dirName/fileName", "src/dirName/fileName" ])

embedBSDir :: FilePath -> Q Exp Source #

Embed a directory recursively in your source code.

import qualified Data.ByteString

myDir :: [(FilePath, Data.ByteString.ByteString)]
myDir = $(embedDir "dirName")