File: Test.lhs

package info (click to toggle)
lhs2tex 1.24-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,976 kB
  • sloc: haskell: 4,408; makefile: 314; sh: 221
file content (164 lines) | stat: -rwxr-xr-x 4,685 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
\documentclass[fleqn]{article}

\usepackage[german]{babel}
\usepackage{moreverb}
\usepackage{boxedminipage}
\parindent0cm

\newcommand{\Show}[1]{\listinginput{1}{#1.snip}\input{#1.tex}}

%-------------------------------=  --------------------------------------------

%include ../lhs2TeX.fmt

%-------------------------------=  --------------------------------------------

\begin{document}

%-------------------------------=  --------------------------------------------
\section{String gaps}
%-------------------------------=  --------------------------------------------

\Show{gap}

%-------------------------------=  --------------------------------------------
\section{Identifiers}
%-------------------------------=  --------------------------------------------

\Show{idents}

%-------------------------------=  --------------------------------------------
\section{Operators}
%-------------------------------=  --------------------------------------------

\Show{operators}

%-------------------------------=  --------------------------------------------
\section{Special symbols}
%-------------------------------=  --------------------------------------------

\Show{special}

%-------------------------------=  --------------------------------------------
\section{Spacing}
%-------------------------------=  --------------------------------------------

\Show{spacing}
\Show{braces}

%-------------------------------=  --------------------------------------------
\section{Indentation}
%-------------------------------=  --------------------------------------------

\Show{indentation}
%
\NB Die senkrechten Striche sind im ersten Beispiel etwas einger"uckt,
da \verb|\mid| als Operator gesetzt wird. Schlie"st man die linke Seite
in \verb|{..}| ein, dann wird |weird| nicht richtig gesetzt. Die rechte
Seite \emph{wird} in \verb|{..}| eingeschlossen, damit |list| und
|main| richtig gesetzt werden (auf diese Weise verliert \verb|\mid|
seinen Status als Operator).

%-------------------------------=  --------------------------------------------
\section{Format directives}
%-------------------------------=  --------------------------------------------

\Show{format}
\Show{parens}

%-------------------------------=  --------------------------------------------
\section{Errors}
%-------------------------------=  --------------------------------------------

\Show{errors}

%-------------------------------=  --------------------------------------------
\section{Meta-Haskell}
%-------------------------------=  --------------------------------------------

Erfordert \verb|-l'meta = True'| Kommandozeilenoption (wichtig: \emph{vor}
\verb@-i lhs2TeX.fmt@ angeben).
%
\Show{meta}

%-------------------------------=  --------------------------------------------
\section{Comments}
%-------------------------------=  --------------------------------------------

\Show{comments}

%-------------------------------=  --------------------------------------------
\section{Verbatim}
%-------------------------------=  --------------------------------------------

\verb|khadrkh| und \verb*|kjhsfd  kjghsdf|.
%
\begin{verbatim}
bass  sdakh asd asd
\end{verbatim}
%
\begin{verbatim*}
bass  sdakh asd asd
\end{verbatim*}

%-------------------------------=  --------------------------------------------
\section{Active commands}
%-------------------------------=  --------------------------------------------

|product [1..20]| yields \eval{product [1..20]}.
%if False

> default (Integer)

> group n			=  map (take n)
>				.  takeWhile (not . null)
>				.  iterate (drop n)
> rows				=  concat
>				.  intersperse " \\\\\n"
>				.  map (\(n, s) -> show n ++ " & " ++ s)
>				.  zip [1 ..]
>				.  group 60
> intersperse s []		=  []
> intersperse s [a]		=  [a]
> intersperse s (a1 : a2 : as)	=  a1 : s : intersperse s (a2 : as)
> out n				=  putStr (rows (show n))

%endif
|product [1..200]| yields
\[
\begin{array}{rl}
    \perform{out (product [1..200])}
\end{array}
\]

> twice f a			=  f (f a)

\eval{:type twice} und \eval{:type twice twice} haben den gleichen
Typ.

%-------------------------------=  --------------------------------------------
\section{Active commands with @ghci@}
%-------------------------------=  --------------------------------------------

%options ghci -fglasgow-exts -fno-monomorphism-restriction
|product [1..20]| yields \eval{product [1..20]}.
%if False

> main = undefined

%endif
|product [1..200]| yields
\[
\begin{array}{rl}
    \perform{out (product [1..200])}
\end{array}
\]

< twice f a			=  f (f a)

%format forall = "\forall "
%format .      = "."
\eval{:type twice} und \eval{:type twice twice} haben den gleichen
Typ.

\end{document}