Skip to content

Commit 7cef1a6

Browse files
committed
fix: update example/functor.carp
Now that a builtin type named Box exists, the definitions in this file cause a conflict. I've renamed the "Box" type in the functor example to remove the conflict.
1 parent 35e7df8 commit 7cef1a6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

examples/functor.carp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
(implements fmap ArrayExtension.fmap)
1111
)
1212

13-
(deftype (Box a) [x a])
13+
(deftype (MyBox a) [x a])
1414

15-
(defmodule Box
16-
(defn fmap [f box] (let [new-x (~f @(Box.x &box))]
17-
(Box.set-x box new-x)))
18-
(implements fmap Box.fmap))
15+
(defmodule MyBox
16+
(defn fmap [f box] (let [new-x (~f @(MyBox.x &box))]
17+
(MyBox.set-x box new-x)))
18+
(implements fmap MyBox.fmap))
1919

20-
(use Box)
20+
(use MyBox)
2121
(use ArrayExtension)
2222

2323
;; TODO: This function currently concretizes to the type of the first (f *) it
@@ -29,8 +29,8 @@
2929

3030
(defn main []
3131
(do
32-
(println &(str @(Box.x &(fmap &Int.inc (Box.init 100)))))
33-
(println &(str @(Box.x &(Box.fmap &inc (Box.init 100)))))
32+
(println &(str @(MyBox.x &(fmap &Int.inc (MyBox.init 100)))))
33+
(println &(str @(MyBox.x &(MyBox.fmap &inc (MyBox.init 100)))))
3434
(println &(str &(ArrayExtension.fmap &inc [10 20 30 40 50])))
3535
(println &(str &(fmap &Int.inc [10 20 30 40 50])))
3636
(println &(Array.str &(fmap &Int.inc [10 20 30 40 50])))

0 commit comments

Comments
 (0)