haskell-toys-0.1.0.0: Little command line toys written in Haskell

Copyright(c) 2016, M J Oldfield
StabilityExperimental
Safe HaskellSafe
LanguageHaskell2010

Toy.Generic

Description

Rationale

I find rather too much boilerplate in little Haskell command line toys I write.

This module is an attempt to abstract that common code, in the hope that I'll both be more efficient and write less hacky tools.

Often particular modules will be more helpful when writing code which e.g. handles Images with Juicy Pixel.

Synopsis

Documentation

processGeneric :: (FilePath -> FilePath -> IO ()) -> (String -> String) -> String -> FilePath -> IO () Source

processGeneric makes it easier to apply functions which take input and output filenames to a list of input names, by programmatically constructing the output name. Typically we munge the basename, then e.g. change the suffix:

processGeneric mungePNG (++ "-m") (f -> replaceExtension f "png")

processArgs :: (FilePath -> IO ()) -> IO () Source

processArgs just calls a function with every command line argument.

main = processArgs putStrLn