Skip to content
Snippets Groups Projects
Commit 5e966abb authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

howto: Fix unicode

parent ae4c3c09
No related branches found
No related tags found
No related merge requests found
#+TITLE: How to implement a functor
#+OPTIONS: toc:nil
#+LATEX_COMPILER: xelatex
#+LATEX_HEADER: \usepackage{libertine}
#+LATEX_HEADER: \usepackage{fontspec}
#+LATEX_HEADER: \setmonofont[Scale=0.9]{Hack}
#+LATEX_HEADER: \usepackage{unicode-math}
#+LATEX_HEADER: \newcommand{\Bag}{\mathcal{B}}
#+LATEX_HEADER: \newcommand{\Dist}{\mathcal{D}}
If you want to add a new basic functor to CoPaR, this document is for you. It's
written in a tutorial style to be easy to follow along. Please refer to CoPaR's
......@@ -46,7 +46,7 @@ documentation and a parser for our functor:
simplePowerset :: FunctorDescription SimplePowerset
simplePowerset = FunctorDescription
{ name = "SimplePowerset"
, syntaxExample = "PX | ƤX"
, syntaxExample = "PX"
, description = Just "Some help text"
, functorExprParser = undefined
}
......@@ -162,15 +162,15 @@ the syntax.
Each functor in CoPaR has a functor expression parser, which are combined to
parse the first line of the input file to determine the functor for the
coalgebra that follows. The functor expression for our powerset should accept
either =P X= or the fancy UTF-8 symbol =Ƥ X= where =X= can be anything. Functors
with similar syntax are very common (e.g. =Ɓ= or =Ɗ=), so there's a helper
function called ~prefix~ that makes writing parsers as easy as:
coalgebra that follows. The functor expression for our powerset should accept =P
X= where =X= can be anything. Functors with similar syntax are very common (e.g.
$\Bag$ or $\Dist$), so there's a helper function called ~prefix~ that makes
writing parsers as easy as:
#+BEGIN_SRC haskell
powersetParser :: _
powersetParser = prefix $ do
L.symbol "P" <|> L.symbol "Ƥ"
L.symbol "P"
return SimplePowerset
#+END_SRC
......@@ -180,7 +180,7 @@ With this implemented, we can now complete our ~FunctorDescription~:
simplePowerset :: FunctorDescription SimplePowerset
simplePowerset = FunctorDescription
{ name = "SimplePowerset"
, syntaxExample = "PX | ƤX"
, syntaxExample = "PX"
, description = Just "Some help text"
, functorExprParser = powersetParser
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment