Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- module Language.Rzk.Syntax.Abs
- parseModuleSafe :: String -> IO (Either String Module)
- parseModule :: String -> Either String Module
- parseModuleRzk :: String -> Either String Module
- parseModuleFile :: FilePath -> IO (Either String Module)
- parseTerm :: String -> Either String Term
- class Print a where
- printTree :: Print a => a -> String
- tryExtractMarkdownCodeBlocks :: String -> String -> String
- extractMarkdownCodeBlocks :: String -> String -> String
- tryOrDisplayException :: Either String a -> IO (Either String a)
- tryOrDisplayExceptionIO :: IO (Either String a) -> IO (Either String a)
Documentation
module Language.Rzk.Syntax.Abs
The printer class does the job.
Instances
printTree :: Print a => a -> String Source #
Like printTree
, but does not insert newlines for curly braces.
extractMarkdownCodeBlocks :: String -> String -> String Source #
Extract code for a given alias (e.g. "rzk" or "haskell") from a Markdown file by replacing any lines that do not belong to the code in that language with blank lines. This way the line numbers are preserved correctly from the original file.
All of the following notations are supported to start a code block:
```rzk
```{.rzk title="Example"}
``` { .rzk title="Example" }
>>>
example = "Example:\n```rzk\n#lang rzk-1\n```\nasd asd\n```rzk\n#def x : U\n := U\n``` \nasda"
>>>
putStrLn example
Example: ```rzk #lang rzk-1 ``` asd asd ```rzk #def x : U := U ``` asda>>>
putStrLn $ extractMarkdownCodeBlocks "rzk" example
#lang rzk-1 #def x : U := U