README files used to be able to lie. Now they can't! Woo!
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
LICENSE
README.lhs
README.md
Setup.hs
package.yaml
stack.yaml

README.md

#!/usr/bin/env stack

-- stack script --resolver lts-8.12 --package turtle --package markdown-unlit -- "-pgmL markdown-unlit"

{-# LANGUAGE OverloadedStrings #-}

import Turtle

Literate README

Build status

The readme that builds itself!

You can setup and build this project by running this very readme. This is what the travis job does!

Example: ./README.lhs --setup --test

parser :: Parser (Bool, Bool, Bool)
parser = (,,) <$> switch "setup" 's' "Set up the stack environment."
              <*> switch "test"  't' "Build the project and run the tests."
              <*> switch "build" 'b' "Just build, don't run tests."
main = void $ do
    (setup, test, build) <- options "Literate README" parser
    let ops = doSetup setup .&&. doBuild build .&&. doTest test
    ops .||. die "Step failed."

nop = shell "true" empty

stackOrNop op True = shell ("stack " <> op) empty
stackOrNop _  _    = nop

Setup

-- | Call this with: ./README.lhs --setup
doSetup = stackOrNop "setup"

Build

-- | Call this with: ./README.lhs --build
doBuild = stackOrNop "build"

Test

-- | Call this with: ./README.lhs --test
doTest = stackOrNop "test"