← All languages

wildling

Haskell library and CLI for pattern-based string generation. Zero Cabal/Hackage third-party packages (GHC boot libraries only; hand-rolled JSON for templates). Targets GHC 9.0+.

Example

Install

From this repository:

cd haskell
./build.sh
./bin/wildling "Year 19##"

From a release tag:

git clone --branch v2.0.0 --depth 1 https://github.com/dotmonk/wildling.git
cd wildling
./build.sh haskell

Produces dist/wildling plus dist/help.txt.

import qualified Data.Map.Strict as Map
import Wildling (createWildling, wildlingNext, WildlingResult(..))

main :: IO ()
main = do
  w <- createWildling ["Year 19##"] Map.empty
  let loop = do
        value <- wildlingNext w
        case value of
          WildlingFalse -> pure ()
          WildlingString s -> putStrLn s >> loop
  loop

CLI

./bin/wildling "Year 19##"
./bin/wildling --dictionary planets:../dictionaries/planets.txt "%{'planets'}"
./bin/wildling --template ./config.json

Help text and --check output follow docs/cli.md / docs/help.txt. Out-of-range --select / --range write out of range: <index> on stderr and exit 1.

Build

./build.sh   # Docker (gcc:14-bookworm): fetch GHC into .ghc (or apt fallback), ghc → dist/wildling

Project tests live in ../tests/ and are run with ../test.sh.