-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A "noDSL" approach to mixing shell scripting with Haskell programs using Template Haskell -- -- A "noDSL" approach to mixing shell scripting with Haskell programs -- using Template Haskell @package THSH @version 0.0.0.4 module THSH.Funclet -- | A funclet is an IO process that communicates through handles and -- returns an exit code. class Funclet f runFunclet :: Funclet f => f -> (ExitCode -> IO ()) -> IO (Handle, Handle, Handle) -- | Existential wrapper of any funclet. data AnyFunclet MkAnyFunclet :: f -> AnyFunclet -- | Run a funclet with standard handles runFuncletWithStdHandles :: Funclet f => f -> IO ExitCode instance THSH.Funclet.Funclet THSH.Funclet.AnyFunclet module THSH.Fn -- | A FnFunction is a function that, given a set of handles to -- communicate with it, it returns an exit code. class FnFunction f runFn :: FnFunction f => f -> (Handle, Handle, Handle) -> IO ExitCode -- | A FnFunction that converts the entire input content to another -- as String. data ContentFn (m :: Type -> Type) s MkContentFn :: (s -> m s) -> (Handle -> m s) -> (Handle -> s -> m ()) -> ContentFn (m :: Type -> Type) s -- | ContentFn for the String type. stringContentFn :: (String -> String) -> ContentFn IO String -- | IO variant of stringContentFn. stringContentIOFn :: (String -> IO String) -> ContentFn IO String -- | ContentFn for the Text type from the text package. textContentFn :: (Text -> Text) -> ContentFn IO Text -- | IO variant of textContentFn. textContentIOFn :: (Text -> IO Text) -> ContentFn IO Text -- | A FnFunction that reads line by line via Read instances -- of a and accumulates context b. data LineReadFn (m :: Type -> Type) a b MkLineReadFn :: (a -> b -> m (b, Maybe String)) -> (b -> m (Maybe String)) -> b -> LineReadFn (m :: Type -> Type) a b -- | Idiomatic wrapper for the MkLineReadFn lineReadFn :: Read a => (a -> b -> (b, Maybe String)) -> (b -> Maybe String) -> b -> LineReadFn IO a b -- | The new type wrapper of any FnFunction instance. data Fn f -- | Marker for the thsh quasi-quote to recognize a FnFunction code -- block. fn :: FnFunction f => f -> Fn f instance THSH.Fn.FnFunction (THSH.Fn.ContentFn GHC.Types.IO s) instance THSH.Fn.FnFunction (THSH.Fn.LineReadFn GHC.Types.IO a b) instance THSH.Fn.FnFunction f => THSH.Funclet.Funclet (THSH.Fn.Fn f) module THSH.Script -- | A script is a funclet that has its source code and a list of other -- funclets it depends on. data Script MkScript :: String -> [AnyFunclet] -> Script [source] :: Script -> String [funclets] :: Script -> [AnyFunclet] -- | The piping code snippet that should substitute the funclet occurrences -- during quasi quoting. genFuncletPipeCode :: Int -> String -- | Marker for the thsh quasi-quote to recognize a Script. sh :: Script -> Script instance THSH.Funclet.Funclet THSH.Script.Script module THSH.QQ -- | The quasi quoter for Template Haskell shell scripts. thsh :: QuasiQuoter module THSH