io-embed-0.1.0.1: Use Template Haskell to embed the result of an IO computation.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.IOEmbed

Synopsis

Documentation

embedIO :: forall a. Typeable a => IO a -> Q Exp Source #

Embeds an IO a value - as long as a is Char, String, Integer, Rational, or ByteString.

{-# LANGUAGE TemplateHaskell #-}

fileContent = $(embedIO $ readFile "./README.md")

embedIOLit :: IO Lit -> Q Exp Source #

If you want to embed something else, you can manually generate an IO Lit and use this function.

{-# LANGUAGE TemplateHaskell #-}

fileContentL = $(embedIOLit $ StringL <$> readFile "./README.md")

toLitE :: forall a. Typeable a => a -> Exp Source #

Converts Char, String, Integer, Rational, or ByteString to a literal expression.