sourcephile
/
git
/
haskell
/
symantic-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6c2e53f
)
iface: add instance `IfThenElseable Viewer`
author
Julien Moutinho
<julm@sourcephile.fr>
Fri, 15 Sep 2023 19:46:43 +0000
(21:46 +0200)
committer
Julien Moutinho
<julm@sourcephile.fr>
Fri, 15 Sep 2023 19:46:43 +0000
(21:46 +0200)
src/Symantic/Semantics/Viewer.hs
patch
|
blob
|
history
diff --git
a/src/Symantic/Semantics/Viewer.hs
b/src/Symantic/Semantics/Viewer.hs
index a29af2cd12c0e703e903a5cf13e6504f9e2e1519..e4eb93236575e646605286ff017353d02bb5fb0e 100644
(file)
--- a/
src/Symantic/Semantics/Viewer.hs
+++ b/
src/Symantic/Semantics/Viewer.hs
@@
-144,5
+144,13
@@
instance Maybeable Viewer where
nothing = "Nothing"
just = "Just"
instance IfThenElseable Viewer where
- ifThenElse test ok ko =
- "if" .@ test .@ "then" .@ ok .@ "else" .@ ko
+ ifThenElse test ok ko = Viewer Fun.$ \env ->
+ pairViewer env op Fun.$
+ showString "if"
+ Fun.. runViewer test env{viewEnv_op = (op, SideL)}
+ Fun.. showString "then"
+ Fun.. runViewer ok env{viewEnv_op = (op, SideL)}
+ Fun.. showString "else"
+ Fun.. runViewer ko env{viewEnv_op = (op, SideL)}
+ where
+ op = infixN 0