Skip to content

Commit ac569fb

Browse files
author
gregory malecha
committed
printString in the printing example.
1 parent bd1caa9 commit ac569fb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

examples/Printing.v

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ Definition print {T : Type} {ST : Show T} (val : T) : PrinterMonad unit :=
1111
@MonadWriter.tell _ (@show_mon _ ShowScheme_string_compose) _ _
1212
(@show _ ST val _ show_inj (@show_mon _ ShowScheme_string_compose)).
1313

14+
Definition printString (str : string) : PrinterMonad unit :=
15+
@MonadWriter.tell _ (@show_mon _ ShowScheme_string_compose) _ _
16+
(@show_exact str _ show_inj (@show_mon _ ShowScheme_string_compose)).
17+
1418
Definition runPrinter {T : Type} (c : PrinterMonad T) : T * string :=
1519
let '(val,str) := unIdent (runWriterT c) in
1620
(val, str ""%string).
1721

1822

19-
Eval compute in runPrinter (Monad.bind (print 1) (fun _ => print 2)).
23+
Eval compute in runPrinter (Monad.bind (print 1) (fun _ => print 2)).
24+
25+
Eval compute in runPrinter (Monad.bind (print "hello "%string) (fun _ => print 2)).
26+
Eval compute in runPrinter (Monad.bind (printString "hello "%string) (fun _ => print 2)).

0 commit comments

Comments
 (0)