kedgeree-demo-0.1.0
 
Safe HaskellNone

Showcase

Description

Showcase — a deliberately pathological module that exercises as many Haddock doc features as possible, so the Kedgeree theme can be checked against all of them at once.

This first paragraph is intentionally long so we can watch how body prose wraps across the full content width. It mixes bold text, /italicised text/, inline code, a reallyLongFunctionNameThatGoesOnForQuiteAWhile identifier link, a Geometry module link, and an external Haskell home page link, all in one breath.

A documentation sub-heading

A deeper collapsible heading
Expand

A deeper heading level that is still collapsible, to check it gets the same bar styling as a top-level Examples or Instances header.

>>> 2 + 2
4

Some text underneath a sub-heading, to check heading rhythm inside docs.

A bullet list:

  • a short item
  • a much longer item, written to be long enough that it wraps onto more than one line so we can confirm list items indent their wrapped lines correctly

    • a nested item
    • another nested item
  • a final top-level item

A numbered list:

  1. first
  2. second
  3. third

A definition list:

Functor
things you can map over
Monad
things you can sequence, with a deliberately long description that should wrap to exercise definition-list wrapping

A code block written with bird tracks:

main :: IO ()
main = putStrLn "a code block whose contents are wide enough to overflow horizontally on a narrow screen xxxxxxxxxxxxxxxxxxxxxxxx"

Interactive examples:

>>> 1 + 1
2
>>> map (* 2) [1, 2, 3]
[2,4,6]

Inline math \(e^{i\pi} + 1 = 0\), and a display equation:

\[ \sum_{i=1}^{n} i = \frac{n (n + 1)}{2} \]

A grid table:

OperationComplexity
lookupO(log n)
insertO(log n)
Synopsis

A large record

data ConfigSource #

A large configuration record with many fields, some carrying long types and long per-field descriptions — a good stress test for record rendering.

Since: kedgeree-demo-1.0.0

Constructors

Config 

Fields

  • configName :: String

    A human-readable name for this configuration. This field description is intentionally verbose so we can see how a long field doc renders relative to its signature, especially once it wraps.

  • configRetryPolicy :: Int -> Maybe (Int, Int)

    A retry policy: given an attempt number, optionally produce a (delayMilliseconds, jitter) pair. Note the function-typed field.

  • configExtraHeaders :: [(String, String)]

    Extra headers attached to every outgoing request.

  • configConnectTimeoutMicroseconds :: Int

    Connection timeout, in microseconds.

  • configVerbose :: Bool

    Whether to emit verbose diagnostic logging.

  • configOnEvent :: forall a. Show a => a -> IO ()

    A rank-2 callback invoked on every event — the type uses an explicit forall and a constraint, making it pleasantly long.

  • configResultHandler :: Either String (Maybe [(String, Int)]) -> IO (Either String (Maybe [(Int, Int)]))

    A handler with a long, deeply nested type, so we can see how a long record-field signature renders when it has to wrap.

defaultConfig :: ConfigSource #

A sensible Config to start from.

Since: kedgeree-demo-1.0.0

Long signatures & per-argument docs

reallyLongFunctionNameThatGoesOnForQuiteAWhile :: (Eq a, Num a, Ord a, Show a) => a -> a -> a -> Either String (a, a, a)Source #

A function with an absurdly long name and a long, multi-constraint type signature. On a narrow screen the name breaks and the signature wraps at its arrows rather than scrolling.

Since: kedgeree-demo-2.1.0

withArgumentDocs :: Int -> String -> Bool -> StringSource #

Arguments

:: Int

the count, which must be positive

-> String

a label for the result

-> Bool

whether to shout

-> String

the resulting, fully assembled description

A function that documents each of its arguments individually, which Haddock renders as an argument table.

Examples

Expand

A plain call assembles the label and count:

>>> withArgumentDocs 3 "tries" False
"tries3"

Turning on loud prefixes a bang:

>>> withArgumentDocs 3 "tries" True
"!tries3"

withLongArgumentTypes :: Config -> (Int -> Either String (Maybe [(String, String)])) -> [(String, Int -> IO ())] -> IO ()Source #

Arguments

:: Config

the configuration record to apply before running

-> (Int -> Either String (Maybe [(String, String)]))

a callback with a long, deeply nested type whose rendering would otherwise crowd the per-argument description into a sliver

-> [(String, Int -> IO ())]

an association list mapping names to effectful, integer-taking callbacks

-> IO () 

A per-argument-documented function whose argument types are deliberately long and nested — the pathological case for the argument table. With the type and its description side by side, a type like the second argument's would crowd the prose into a sliver — stacking each argument (type on its own line, description below) keeps both readable.

Type classes

class Show (Elem c) => Container c whereSource #

A type class with a superclass constraint, an associated type family, a couple of methods, and a method with a default implementation.

Since: kedgeree-demo-0.3.0

Minimal complete definition

empty, insert

Associated Types

type Elem cSource #

The element type of the container.

Methods

empty :: cSource #

The empty container.

insert :: Elem c -> c -> cSource #

Insert an element at the front.

size :: c -> IntSource #

The number of elements. Has a default of 0.

Instances

Instances details
Show a => Container (Maybe a) Source #

Maybe is a (degenerate) container holding at most one element.

Since: kedgeree-demo-0.3.0

Instance details

Defined in Showcase

Associated Types

type Elem (Maybe a) 
Instance details

Defined in Showcase

type Elem (Maybe a) = a

Methods

empty :: Maybe aSource #

insert :: Elem (Maybe a) -> Maybe a -> Maybe aSource #

size :: Maybe a -> IntSource #

Show a => Container [a] Source #

Lists are containers.

Since: kedgeree-demo-0.3.0

Instance details

Defined in Showcase

Associated Types

type Elem [a] 
Instance details

Defined in Showcase

type Elem [a] = a

Methods

empty :: [a]Source #

insert :: Elem [a] -> [a] -> [a]Source #

size :: [a] -> IntSource #

class Convert a b whereSource #

A multi-parameter type class for lossy conversions.

Methods

convert :: a -> bSource #

Convert from a to b.

Instances

Instances details
Convert (Either String (Maybe (Int, Int))) (Either String (Maybe [(String, [Bool])])) Source #

A conversion with a deliberately long instance head, to exercise how a long instance signature renders when it wraps.

Instance details

Defined in Showcase

Methods

convert :: Either String (Maybe (Int, Int)) -> Either String (Maybe [(String, [Bool])])Source #

class Describe a whereSource #

A class with a deliberately long list of instances, so the stacked instance accordions can be seen en masse on a single page.

Since: kedgeree-demo-0.4.0

Methods

describe :: a -> StringSource #

Render a one-line human description.

Instances

Instances details
Describe Ordering Source # 
Instance details

Defined in Showcase

Methods

describe :: Ordering -> StringSource #

Describe Point Source # 
Instance details

Defined in Showcase

Methods

describe :: Point -> StringSource #

Describe Integer Source # 
Instance details

Defined in Showcase

Methods

describe :: Integer -> StringSource #

Describe () Source # 
Instance details

Defined in Showcase

Methods

describe :: () -> StringSource #

Describe Bool Source # 
Instance details

Defined in Showcase

Methods

describe :: Bool -> StringSource #

Describe Char Source # 
Instance details

Defined in Showcase

Methods

describe :: Char -> StringSource #

Describe Double Source # 
Instance details

Defined in Showcase

Methods

describe :: Double -> StringSource #

Describe Float Source # 
Instance details

Defined in Showcase

Methods

describe :: Float -> StringSource #

Describe Int Source # 
Instance details

Defined in Showcase

Methods

describe :: Int -> StringSource #

Describe a => Describe (Maybe a) Source # 
Instance details

Defined in Showcase

Methods

describe :: Maybe a -> StringSource #

Describe a => Describe [a] Source # 
Instance details

Defined in Showcase

Methods

describe :: [a] -> StringSource #

(Describe a, Describe b) => Describe (Either a b) Source # 
Instance details

Defined in Showcase

Methods

describe :: Either a b -> StringSource #

(Describe a, Describe b) => Describe (a, b) Source # 
Instance details

Defined in Showcase

Methods

describe :: (a, b) -> StringSource #

(Describe a, Describe b, Describe c) => Describe (a, b, c) Source # 
Instance details

Defined in Showcase

Methods

describe :: (a, b, c) -> StringSource #

class (Eq c, Eq e, Show c, Show e) => Indexed c e | c -> e whereSource #

A multi-parameter class with a long header AND a functional dependency, to check that the fundep arrow (| c -> e) stays whole rather than breaking like a function arrow.

Methods

index :: c -> Int -> Maybe eSource #

The element at an index, if present.

class Render a whereSource #

A class with a default method signature (DefaultSignatures), so Haddock renders the extra default render :: ... type signature.

Minimal complete definition

Nothing

Methods

render :: a -> StringSource #

Render a value as text.

default render :: Show a => a -> StringSource #

class (Bounded a, Enum a, Eq a, Integral a, Num a, Ord a, Read a, Real a, Show a) => Tabulate a whereSource #

A class with a deliberately long superclass context, to stress how a wide constraint tuple renders in the class header (and how it wraps on a narrow screen).

Since: kedgeree-demo-0.5.0

Minimal complete definition

Nothing

Methods

tabulate :: a -> StringSource #

Render the value as a fixed-width table cell.

Instances

Instances details
Tabulate Int Source # 
Instance details

Defined in Showcase

Methods

tabulate :: Int -> StringSource #

GADTs & existentials

data Expr a whereSource #

A simple, type-indexed expression GADT.

Since: kedgeree-demo-1.2.0

Constructors

IntLit :: Int -> Expr Int

An integer literal.

BoolLit :: Bool -> Expr Bool

A boolean literal.

Add :: Expr Int -> Expr Int -> Expr Int

Addition of two integer expressions.

If :: forall a. Expr Bool -> Expr a -> Expr a -> Expr a

A conditional whose branches must agree, with a longish signature.

Annotated :: forall a. String -> [(String, String)] -> Either String (Maybe (Expr a)) -> Maybe (Int, Int) -> Expr a

A constructor with a deliberately long, nested signature, to show how a long GADT constructor type renders when it wraps.

Bundled Patterns

pattern Zero :: Expr Int

The zero literal, as a pattern synonym bundled with Expr. Here to show how a bundled pattern's description lays out next to other declarations.

Examples

Expand
>>> Zero
IntLit 0

data ShowableSource #

An existential box around anything Showable.

Constructors

Show a => MkShowable a 

Operators

(>+<) :: [a] -> [a] -> [a] infixr 5Source #

Concatenate two lists with a custom right-associative operator.

Since: kedgeree-demo-0.1.0

Deprecated things

oldFunction :: Int -> IntSource #

Deprecated: Use a newer function instead. This deprecation message is intentionally long so we can see how a multi-line warning notice renders once it wraps.

An old function that should no longer be used.

Re-exported modules

The whole Geometry module is re-exported here, which Haddock renders as a module Geometry entry rather than inlining its declarations.

module Geometry

Orphan instances

Semigroup Point Source #

Points form a semigroup under componentwise addition. Both Point and Semigroup are defined elsewhere, so Haddock lists this under a separate Orphan instances section at the foot of the page.

Instance details

Methods

(<>) :: Point -> Point -> Point

sconcat :: NonEmpty Point -> Point

stimes :: Integral b => b -> Point -> Point