Skip to content

Instantly share code, notes, and snippets.

@dgendill
Last active April 16, 2017 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgendill/1da1ca10970d4dd4e572a4c0554430a8 to your computer and use it in GitHub Desktop.
Save dgendill/1da1ca10970d4dd4e572a4c0554430a8 to your computer and use it in GitHub Desktop.
Local Documentation In PureScript 0.10.x

Generating Local Documentation In PureScript 0.10.x

Note: It's probably easier to run a local installation of pursuit.


If pulp docs --with-dependencies or psc-docs isn't working for you, this one-liner may be helpful to generate documentation. Run the following command in your project root, and you should get a set of .md files in the docs directory along with a single index.html file (You'll need to install pandoc).

bash doccommand=$(echo -n "psc-docs 'bower_components/**/.purs' "; find bower_components/. -name ".purs" -exec sed -n '/-- |/d;/-- |/d;/^$/d;1p' {} ; | tr -d '\r' | awk '/module/ {print "--docgen " $2 ":docs/" $2 ".md"}' | sort -u) && eval $doccommand && pandoc "docs/*.md" -o docs/index.html

The index.html file isn't particularly pretty, but it does work.

The command basically parses all the .purs files in bower_components and builds a command for psc-docs like this...

psc-docs 'bower_components/**/*.purs' --docgen Control.Alt:docs/Control.Alt.md --docgen Control.Alternative:docs/Control.Alternative.md --docgen Control.Applicative:docs/Control.Applicative.md --docgen Control.Applicative.Free:docs/Control.Applicative.Free.md --docgen Control.Apply:docs/Control.Apply.md --docgen Control.Biapplicative:docs/Control.Biapplicative.md --docgen Control.Biapply:docs/Control.Biapply.md --docgen Control.Bind:docs/Control.Bind.md --docgen Control.Category:docs/Control.Category.md --docgen Control.Comonad:docs/Control.Comonad.md --docgen Control.Extend:docs/Control.Extend.md --docgen Control.Lazy:docs/Control.Lazy.md --docgen Control.Monad:docs/Control.Monad.md --docgen Control.Monad.Eff.Class:docs/Control.Monad.Eff.Class.md --docgen Control.Monad.Eff.Console:docs/Control.Monad.Eff.Console.md --docgen Control.Monad.Eff:docs/Control.Monad.Eff.md --docgen Control.Monad.Eff.Exception.Unsafe:docs/Control.Monad.Eff.Exception.Unsafe.md --docgen Control.Monad.Eff.Unsafe:docs/Control.Monad.Eff.Unsafe.md --docgen Control.MonadPlus:docs/Control.MonadPlus.md --docgen Control.Monad.Rec.Class:docs/Control.Monad.Rec.Class.md --docgen Control.Monad.ST:docs/Control.Monad.ST.md --docgen Control.MonadZero:docs/Control.MonadZero.md --docgen Control.Plus:docs/Control.Plus.md --docgen Control.Semigroupoid:docs/Control.Semigroupoid.md


"Can't mix module names and module name/file path pairs in the same invocation."

Installing Pursuit for PureScript 10.x Locally

Run the following commands (assumes you have Haskell's cabal and stack installed)

git clone --branch v0.4.13 https://github.com/purescript/pursuit.git
cd pursuit
cabal install alex happy
stack build
git clone https://github.com/purescript/pursuit-backups.git data/verified
cd data/verified; git checkout 0403dcf7cac90295a5cb27fca826cd0230ba6180
cd ../..
stack exec pursuit

It should then be running on http://localhost:3000/.

To ease startup, I have a desktop script to start the server.

#!/bin/bash
cd /home/dom/pursuit
stack exec pursuit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment