Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CoPaR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Informatik 8
CoPaR
Commits
5e966abb
Commit
5e966abb
authored
6 years ago
by
Hans-Peter Deifel
Browse files
Options
Downloads
Patches
Plain Diff
howto: Fix unicode
parent
ae4c3c09
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/HOWTO_IMPLEMENT_A_FUNCTOR.org
+10
-10
10 additions, 10 deletions
doc/HOWTO_IMPLEMENT_A_FUNCTOR.org
with
10 additions
and
10 deletions
doc/HOWTO_IMPLEMENT_A_FUNCTOR.org
+
10
−
10
View file @
5e966abb
#+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
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment