| Safe Haskell | None |
|---|
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
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 + 24
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:
- first
- second
- 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 + 12>>>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:
| Operation | Complexity |
|---|---|
| lookup | O(log n) |
| insert | O(log n) |
Synopsis
- data Config = Config {
- configName :: String
- configRetryPolicy :: Int -> Maybe (Int, Int)
- configExtraHeaders :: [(String, String)]
- configConnectTimeoutMicroseconds :: Int
- configVerbose :: Bool
- configOnEvent :: forall a. Show a => a -> IO ()
- configResultHandler :: Either String (Maybe [(String, Int)]) -> IO (Either String (Maybe [(Int, Int)]))
- defaultConfig :: Config
- reallyLongFunctionNameThatGoesOnForQuiteAWhile :: (Eq a, Num a, Ord a, Show a) => a -> a -> a -> Either String (a, a, a)
- withArgumentDocs :: Int -> String -> Bool -> String
- withLongArgumentTypes :: Config -> (Int -> Either String (Maybe [(String, String)])) -> [(String, Int -> IO ())] -> IO ()
- class Show (Elem c) => Container c where
- class Convert a b where
- convert :: a -> b
- class Describe a where
- describe :: a -> String
- class (Eq c, Eq e, Show c, Show e) => Indexed c e | c -> e where
- index :: c -> Int -> Maybe e
- class Render a where
- render :: a -> String
- class (Bounded a, Enum a, Eq a, Integral a, Num a, Ord a, Read a, Real a, Show a) => Tabulate a where
- tabulate :: a -> String
- data Expr a where
- data Showable = Show a => MkShowable a
- (>+<) :: [a] -> [a] -> [a]
- oldFunction :: Int -> Int
- module Geometry
A large record
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
| |
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
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
Methods
The empty container.
insert :: Elem c -> c -> cSource #
Insert an element at the front.
The number of elements. Has a default of 0.
class Convert a b whereSource #
A multi-parameter type class for lossy conversions.
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
Instances
| Describe Ordering Source # | |
| Describe Point Source # | |
| Describe Integer Source # | |
| Describe () Source # | |
| Describe Bool Source # | |
| Describe Char Source # | |
| Describe Double Source # | |
| Describe Float Source # | |
| Describe Int Source # | |
| Describe a => Describe (Maybe a) Source # | |
| Describe a => Describe [a] Source # | |
| (Describe a, Describe b) => Describe (Either a b) Source # | |
| (Describe a, Describe b) => Describe (a, b) Source # | |
| (Describe a, Describe b, Describe c) => Describe (a, b, c) Source # | |
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.
A class with a default method signature (DefaultSignatures), so Haddock
renders the extra default render :: ... type signature.
Minimal complete definition
Nothing
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
GADTs & existentials
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. |
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