aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Haddock/Types.hs')
-rw-r--r--src/Haddock/Types.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Haddock/Types.hs b/src/Haddock/Types.hs
index 4e076a26..610f958c 100644
--- a/src/Haddock/Types.hs
+++ b/src/Haddock/Types.hs
@@ -278,8 +278,17 @@ data Doc id
| DocURL String
| DocPic String
| DocAName String
+ | DocExamples [Example]
deriving (Eq, Show, Functor)
+data Example = Example { exampleExpression :: String
+ , exampleResult :: [String]
+ }
+ deriving (Eq, Show)
+
+exampleToString :: Example -> String
+exampleToString (Example expression result) =
+ "ghci> " ++ expression ++ "\n" ++ unlines result
#ifdef TEST
-- TODO: use derive
@@ -321,7 +330,8 @@ data DocMarkup id a = Markup {
markupCodeBlock :: a -> a,
markupURL :: String -> a,
markupAName :: String -> a,
- markupPic :: String -> a
+ markupPic :: String -> a,
+ markupExample :: [Example] -> a
}