|
1 | | -module Examples.Nested where |
| 1 | +module Examples.Control.Lens.Nested where |
2 | 2 |
|
3 | 3 | import Control.Lens |
4 | 4 |
|
@@ -28,15 +28,15 @@ module Examples.Nested where |
28 | 28 |
|
29 | 29 | foreign import showFooImpl |
30 | 30 | "function showFooImpl(foo) {\ |
31 | | - \ return JSON.stringify(foo, null, 4);\ |
| 31 | + \ return JSON.stringify(foo);\ |
32 | 32 | \}" :: forall a. a -> String |
33 | 33 |
|
34 | 34 | main = do |
35 | | - trace $ showFooImpl obj |
36 | | - trace $ showFooImpl $ baz.~10 $ obj |
37 | | - trace $ showFooImpl $ baz.~"wat" $ obj |
38 | | - trace $ showFooImpl $ foo'..bar.~10 $ obj |
39 | | - trace $ showFooImpl $ fooBar+~40 $ obj |
40 | | - trace $ showFooImpl $ obj^.fooBar |
41 | | - trace $ showFooImpl (obj#fooBar%~succ) |
42 | | - trace $ showFooImpl (over (fooBar) succ obj) |
| 35 | + trace $ showFooImpl obj -- {"foo":{"bar":0},"baz":true} |
| 36 | + trace $ showFooImpl $ baz.~10 $ obj -- {"foo":{"bar":0},"baz":10} |
| 37 | + trace $ showFooImpl $ baz.~"wat" $ obj -- {"foo":{"bar":0},"baz":"wat"} |
| 38 | + trace $ showFooImpl $ foo'..bar.~10 $ obj -- {"foo":{"bar":10},"baz":true} |
| 39 | + trace $ showFooImpl $ fooBar+~40 $ obj -- {"foo":{"bar":40},"baz":true} |
| 40 | + trace $ showFooImpl $ obj^.fooBar -- 0 |
| 41 | + trace $ showFooImpl (obj#fooBar%~succ) -- {"foo":{"bar":1},"baz":true} |
| 42 | + trace $ showFooImpl (over (fooBar) succ obj) -- {"foo":{"bar":1},"baz":true} |
0 commit comments