readme-lhs: See readme.md

[ bsd3, deprecated, development, library, program ] [ Propose Tags ]
Deprecated

See readme.md for description.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0, 0.8.1
Dependencies base (>=4.7 && <5), containers, optparse-generic, pandoc, pandoc-types, protolude, readme-lhs, text [details]
License BSD-3-Clause
Copyright 2016 Tony Day
Author Tony Day
Maintainer tonyday567@gmail.com
Category Development
Home page https://github.com/tonyday567/readme-lhs#readme
Bug tracker https://github.com/tonyday567/readme-lhs/issues
Source repo head: git clone https://github.com/tonyday567/readme-lhs
Uploaded by tonyday567 at 2019-07-23T05:21:10Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables readme-lhs-example
Downloads 3330 total (25 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-07-23 [all 1 reports]

Readme for readme-lhs-0.2.0

[back to package description]

readme-lhs Build Status

The language in which we express our ideas has a strong influence on our thought processes. \~ Knuth

This is an example of mixing literate haskell with markdown, and in using Readme.Lhs. The file is composed of several elements:

  • literate haskell. Bird-tracks are used, as the alternative method is latex rather than markdown, which doesn’t survive a pandoc round trip.

  • markdown. All non bird-tracked lines are considered to be markdown. It’s probably incompatible with haddock, but this may well resolve with adoption of the literate markdown ghc proposal.

  • fenced code blocks with an output class, which are used to insert computation results. The fenced code blocks look like:

    ```{.output .example} ```

ghc options

{-# OPTIONS_GHC -Wall #-}

pragmas

-- doctest doesn't look at the cabal file, so you need pragmas here
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleInstances #-}

libraries

import Protolude
import Readme.Lhs

code

main :: IO ()
main = do
  let n = 10
  let answer = product [1..n::Integer]
  _ <- runOutput ("example.lhs", LHS) ("readme.md", GitHubMarkdown) $ do
    output "example1" "Simple example of an output"
Simple example of an output
    output "example2" (show answer)

10! is equal to:

3628800
  pure ()

Output that doesn’t exist is simply cleared.

hsfiles writeup

A literate-programming friendly; tight work-flow stack template.

other/readme-lhs.hsfiles

other/batteries.hsfiles

This is my latest working template, overly influenced by lexi-lambda’s opinionated guide. The template includes:

  • some minor tweaks to protolude
  • lens, foldl, formatting & text as must have libraries
  • generic-lens-labels

workflow

stack build --exec "$(stack path --local-install-root)/bin/readme-lhs-example" --file-watch