parsonsmatt / kale

A quick, easy, and declarative task runner for Haskell code to destroy your boiler plate!
BSD 3-Clause "New" or "Revised" License
33 stars 5 forks source link

Allow command arguments #14

Closed parsonsmatt closed 6 years ago

parsonsmatt commented 6 years ago

This PR allows the user to provide an Args datatype that represents the command line arguments.

The user would put the type in the module:

module Lib.FooTask where

data Args = Args { fooName :: String }

task :: Args -> IO ()
task args = putStrLn (fooName args)

The corresponding command type gets:

data Command = Foo { fooName :: String }

And when casing on it, we do:

case cmd of
  Foo {..} -> Lib.FooTask.task Lib.FooTask.Args {..}