haddock-cheatsheet-0.1.0.1: A documentation-only package exemplifying haddock markup features

Copyright(c) <Dai> 2019
LicenseMIT
Maintainer<daig@sodality.cc>
Stabilitycursed
Portabilityx86-64
Safe HaskellSafe
LanguageHaskell2010
Extensions
  • MonoLocalBinds
  • GADTs
  • GADTSyntax
  • PatternSynonyms

Doc.Haddock

Contents

Description

A longer description of the module with arbitrary markup

{-# OPTIONS_HADDOCK hide #-}

Omit this module from the generated documentation, but nevertheless propagate definitions and documentation from within this module to modules that re-export those definitions.

{-# OPTIONS_HADDOCK prune #-}

Omit definitions that have no documentation annotations.

{-# OPTIONS_HADDOCK ignore-exports #-}

Ignore the export list. ie. generate documentation for all top-level declarations

{-# OPTIONS_HADDOCK not-home #-}

Do not consider a definition in this module for home links unless no other module exports it.

By default all internal hyperlinks refer to the earliest/deepest dependency exporting it.

{-# OPTIONS_HADDOCK show-extensions #-}

List all extensions enabled in this module in the module description box

Synopsis

Section Headings

-- * Headings

Section Subheadings

-- * Subheadings

must be seperated by blank (no --) line from other headings or will parse as list

Inline headings

Are collapsible when bold

Expand
= __Are collapsible when bold__

But don't show up in the outline

Nested subheaders fall under collapse

== Nested subheaders fall under collapse

But larger headers do not

= But larger headers do not

Formatting

emphasis

/emphasis/

bold

__bold__
monospaced on its own line
@monospaced on its own line@

inline monospace

@inline@ monospace

Unicode: λ, λ and λ

Unicode: &x3bb; and &#955;

Hyperlinks

Local links

Link to module Prelude

-- Link to module "Prelude"

Link to module-scoped identifier'

Link to module-scoped 'identifier''

Link to fully qualified head

Link to fully qualified 'Data.List.head'

Link to arbitrary anchor in module Doc.Haddock

Link to arbitrary anchor in module "Doc.Haddock#anchor_label"

Descriptive link to anchor in same file

Descriptive link to [anchor](#anchor_label) in same module

External urls

descriptive link

 [descriptive link](http://google.com)

bare url: http://google.com

<http://google.com>

relative_path

<relative_path>

![images](https://raw.githubusercontent.com/haskell/haskell-platform/master/hptool/os-extras/win/icons/hsicon.ico)

Named Chunks

can be used to declutter the export list, and include documentation in arbitrary locations, not associated with any identifier

-- $namedChunk
-- lots of text

Lists

  • Star bullet *
  • Dash bullet -
  1. numbered bullet 2.

    • Nested list by 4 spaces. Can be any type
    foo
    description
  2. braced number bullet (5)
labeled
description list [labeled]:

Notice numbers start from 1 and ignore actual index.

\( \LaTeX \)

Displayed via mathjax

\( in-line math \)

-- \( in-line math \)

\[ displayed math \]

-- \[ displayed math \]

Grid tables

This is a grid table:

Header row, column 1 (header rows optional) Header 2 Header 3 Header 4
body row 1, column 1 column 2 column 3 column 4
body row 2 Cells may span columns.
body row 3 Cells may span rows. \[ f(n) = \sum_{i=1} \]
body row 4

Examples

>>> let fib = undefined
>>> fib 10

55
-- >>> let fib = undefined
-- >>> fib 10
-- <BLANKLINE>
-- 55

Can be utilizied by third-party programs like doctest

Properties

a + b = b + a
-- prop> a + b = b + a

Can be used by third-party libraries like doctest

Data and function annotations

data Constructors a Source #

Constructors

C1 a

The first constructor

C2 a

another constructor

C3

The last constructor

data Record a b Source #

Constructors

Record 

Fields

data GADT a where Source #

Constructors

GADT1

The first constructor

Fields

  • :: a

    marking arguments

  • -> a

    inline

  • -> GADT a

    and return val

GADT2

The second constructor

Fields

  • :: ()

    Marking arguments

  • -> GADT a

    On each line

data GADTRecord a b where Source #

Constructors

GADTRecord 

Fields

  • :: { fa :: a

    first

  •    , fb :: [a]

    second

  •    } -> GADTRecord a a

    return

identifier' :: () Source #

This identifier contains an This identifier contains an #anchor_label#

Since: 0.1.0.0

Reexported identifiers

partial reexports are listed individually

pattern (:+) :: !a -> !a -> Complex a infix 6 #

forms a complex number from its real and imaginary rectangular components.

total reexports are linked indirectly

individual reexports

mkPolar :: Floating a => a -> a -> Complex a #

Form a complex number from polar components of magnitude and phase.

Original documentation can be augmented with named chunks, but is not attached to the identifier so will not appear on reexports

imagPart :: Complex a -> a #

Extracts the imaginary part of a complex number.