-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Transform text from the command-line using Haskell expressions. -- -- Hawk is a command line utility to process streams of text using -- Haskell code. It is intended to be used in a UNIX pipeline. It offers -- a configuration system to personalize imported modules and a way to -- represent values on the console. @package haskell-awk @version 1.1 -- | Used by Hawk's runtime to format the output of a Hawk expression. You -- can use this from your user prelude if you want Hawk to print your -- custom datatypes in a console-friendly format. module System.Console.Hawk.Representable -- | A type that instantiate ListAsRow is a type that has a representation -- when is embedded inside a list -- -- For example: -- --
--   >>> mapM_ Data.ByteString.Lazy.Char8.putStrLn $ repr Data.ByteString.Lazy.Char8.empty "test"
--   test
--   
class Show a => ListAsRow a where listRepr' d = intercalate d . map (pack . show) listRepr' :: ListAsRow a => ByteString -> [a] -> ByteString -- | A type that instantiate ListAsRows is a type that has a representation -- when is embedded inside a list -- -- Note: we use this class for representing a list of chars as String -- instead of the standard list representation. Without this repr -- test would yield [t,e,s,r] -- instead of test. -- -- For example: -- --
--   >>> mapM_ Data.ByteString.Lazy.Char8.putStrLn $ repr Data.ByteString.Lazy.Char8.empty "test"
--   test
--   
class Row a => ListAsRows a where listRepr d = map (repr' d) listRepr :: ListAsRows a => ByteString -> [a] -> [ByteString] -- | A Row is something that can be expressed as a record. The output of -- repr' should be formatted such that it can be read and processed from -- the command line. -- -- For example: -- --
--   >>> putStrLn $ show [1,2,3,4]
--   [1,2,3,4]
--   
-- --
--   >>> Data.ByteString.Lazy.Char8.putStrLn $ repr' (Data.ByteString.Lazy.Char8.pack " ") [1,2,3,4]
--   1 2 3 4
--   
class Show a => Row a where repr' _ = pack . show repr' :: Row a => ByteString -> a -> ByteString -- | A type that instantiate Rows is a type that can be represented as a -- list of rows, where typically a row is a line. -- -- For example: -- --
--   >>> mapM_ Data.ByteString.Lazy.Char8.putStrLn $ repr (Data.ByteString.Lazy.Char8.singleton '\n') [1,2,3,4]
--   1
--   2
--   3
--   4
--   
class Show a => Rows a where repr _ = (: []) . pack . show repr :: Rows a => ByteString -> a -> [ByteString] instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i, Row l) => Rows (a, b, c, d, e, f, g, h, i, l) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i) => Rows (a, b, c, d, e, f, g, h, i) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h) => Rows (a, b, c, d, e, f, g, h) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g) => Rows (a, b, c, d, e, f, g) instance (Row a, Row b, Row c, Row d, Row e, Row f) => Rows (a, b, c, d, e, f) instance (Row a, Row b, Row c, Row d, Row e) => Rows (a, b, c, d, e) instance (Row a, Row b, Row c, Row d) => Rows (a, b, c, d) instance (Row a, Row b, Row c) => Rows (a, b, c) instance (Row a, Row b) => Rows (a, b) instance ListAsRows a => Rows (Set a) instance (Row a, Row b) => Rows (Map a b) instance Rows a => Rows (Maybe a) instance Rows ByteString instance Rows Char instance Rows () instance Rows Integer instance Rows Int instance Rows Float instance Rows Double instance Rows Bool instance ListAsRows a => Rows [a] instance (Row a, Row b) => ListAsRows (Map a b) instance (ListAsRow a, ListAsRows a) => ListAsRows (Set a) instance ListAsRows Char instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i, Row l) => ListAsRows (a, b, c, d, e, f, g, h, i, l) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i) => ListAsRows (a, b, c, d, e, f, g, h, i) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h) => ListAsRows (a, b, c, d, e, f, g, h) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g) => ListAsRows (a, b, c, d, e, f, g) instance (Row a, Row b, Row c, Row d, Row e, Row f) => ListAsRows (a, b, c, d, e, f) instance (Row a, Row b, Row c, Row d, Row e) => ListAsRows (a, b, c, d, e) instance (Row a, Row b, Row c, Row d) => ListAsRows (a, b, c, d) instance (Row a, Row b, Row c) => ListAsRows (a, b, c) instance (Row a, Row b) => ListAsRows (a, b) instance (ListAsRow a, ListAsRows a) => ListAsRows [a] instance ListAsRows () instance Row a => ListAsRows (Maybe a) instance ListAsRows Integer instance ListAsRows Int instance ListAsRows Float instance ListAsRows Double instance ListAsRows Bool instance ListAsRows ByteString instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i, Row l) => Row (a, b, c, d, e, f, g, h, i, l) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i) => Row (a, b, c, d, e, f, g, h, i) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h) => Row (a, b, c, d, e, f, g, h) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g) => Row (a, b, c, d, e, f, g) instance (Row a, Row b, Row c, Row d, Row e, Row f) => Row (a, b, c, d, e, f) instance (Row a, Row b, Row c, Row d, Row e) => Row (a, b, c, d, e) instance (Row a, Row b, Row c, Row d) => Row (a, b, c, d) instance (Row a, Row b, Row c) => Row (a, b, c) instance (Row a, Row b) => Row (a, b) instance Row a => Row (Maybe a) instance Row ByteString instance (Row a, Row b) => Row (Map a b) instance ListAsRow a => Row (Set a) instance ListAsRow a => Row [a] instance Row Char instance Row () instance Row Integer instance Row Int instance Row Double instance Row Float instance Row Bool instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i, Row l) => ListAsRow (a, b, c, d, e, f, g, h, i, l) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i) => ListAsRow (a, b, c, d, e, f, g, h, i) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h) => ListAsRow (a, b, c, d, e, f, g, h) instance (Row a, Row b, Row c, Row d, Row e, Row f, Row g) => ListAsRow (a, b, c, d, e, f, g) instance (Row a, Row b, Row c, Row d, Row e, Row f) => ListAsRow (a, b, c, d, e, f) instance (Row a, Row b, Row c, Row d, Row e) => ListAsRow (a, b, c, d, e) instance (Row a, Row b, Row c, Row d) => ListAsRow (a, b, c, d) instance (Row a, Row b, Row c) => ListAsRow (a, b, c) instance (Row a, Row b) => ListAsRow (a, b) instance (Row a, Row b) => ListAsRow (Map a b) instance ListAsRow ByteString instance ListAsRow Char instance ListAsRow a => ListAsRow (Set a) instance Row a => ListAsRow (Maybe a) instance ListAsRow a => ListAsRow [a] instance ListAsRow () instance ListAsRow Integer instance ListAsRow Int instance ListAsRow Double instance ListAsRow Float instance ListAsRow Bool -- | The precisely-typed version of Hawk's command-line arguments. module System.Console.Hawk.Args.Spec data HawkSpec Help :: HawkSpec Version :: HawkSpec Eval :: ExprSpec -> OutputSpec -> HawkSpec Apply :: ExprSpec -> InputSpec -> OutputSpec -> HawkSpec Map :: ExprSpec -> InputSpec -> OutputSpec -> HawkSpec data InputSpec InputSpec :: InputSource -> InputFormat -> InputSpec inputSource :: InputSpec -> InputSource inputFormat :: InputSpec -> InputFormat data OutputSpec OutputSpec :: OutputSink -> OutputFormat -> OutputSpec outputSink :: OutputSpec -> OutputSink outputFormat :: OutputSpec -> OutputFormat data InputSource NoInput :: InputSource UseStdin :: InputSource InputFile :: FilePath -> InputSource data OutputSink UseStdout :: OutputSink data InputFormat RawStream :: InputFormat Records :: Separator -> RecordFormat -> InputFormat data RecordFormat RawRecord :: RecordFormat Fields :: Separator -> RecordFormat data OutputFormat OutputFormat :: Delimiter -> Delimiter -> OutputFormat recordDelimiter :: OutputFormat -> Delimiter fieldDelimiter :: OutputFormat -> Delimiter type Delimiter = ByteString data Separator Whitespace :: Separator Delimiter :: Delimiter -> Separator fromSeparator :: Separator -> Delimiter data ExprSpec ExprSpec :: FilePath -> String -> ExprSpec userContextDirectory :: ExprSpec -> FilePath userExpression :: ExprSpec -> String defaultInputSpec :: InputSpec noInput :: InputSpec defaultOutputSpec :: OutputSpec defaultInputFormat :: InputFormat defaultOutputFormat :: OutputFormat defaultRecordSeparator :: Separator defaultFieldSeparator :: Separator defaultRecordDelimiter :: Delimiter defaultFieldDelimiter :: Delimiter instance Show InputSource instance Eq InputSource instance Show OutputSink instance Eq OutputSink instance Show OutputFormat instance Eq OutputFormat instance Show OutputSpec instance Eq OutputSpec instance Show Separator instance Eq Separator instance Show RecordFormat instance Eq RecordFormat instance Show InputFormat instance Eq InputFormat instance Show InputSpec instance Eq InputSpec instance Show ExprSpec instance Eq ExprSpec instance Show HawkSpec instance Eq HawkSpec -- | The part of a HawkSpec used at Runtime. The API may change at any -- time. -- -- Due to a hint limitation, this module is imported unqualified -- when interpreting the user expression. This allows hint to -- read and write the type of the expression which it interprets without -- falling prey to module scoping issues. module System.Console.Hawk.Runtime.Base data HawkRuntime HawkRuntime :: InputSpec -> OutputSpec -> HawkRuntime inputSpec :: HawkRuntime -> InputSpec outputSpec :: HawkRuntime -> OutputSpec newtype HawkIO a HawkIO :: IO a -> HawkIO a runHawkIO :: HawkIO a -> IO a instance Typeable HawkRuntime instance Typeable1 HawkIO instance Show HawkRuntime instance Eq HawkRuntime -- | Applying the user expression as directed by the HawkRuntime. The API -- may change at any time. module System.Console.Hawk.Runtime processTable :: Rows a => HawkRuntime -> ([[ByteString]] -> a) -> HawkIO ()