purescript-lenses
purescript-lenses copied to clipboard
[CHAPTER 1] Array.index does not appear to exist?
Trying to follow along with the examples, I cut and paste the imports into the repl from Product.purs
And then tried to insert the first examples into the repl. The first few worked, but it looks like Array
and Map
aren't in scope. I must have missed some critical piece of setup.
❯❯❯❯ purs --version ~/C/P/purescript-lenses master
0.12.0
❯❯❯❯ pulp repl ~/C/P/purescript-lenses master
Compiling Product
Compiling ProductSolutions
PSCi, version 0.12.0
Type :? for help
import Prelude
> import Product
> import Data.Lens (lens, view, set, over, _1, _2)
>
> import Data.Tuple
> import Data.String as String
> fst $ Tuple 5 "hi"
5
> _.a {a : 5}
5
> Array.index [0, 5, 50] 1
Error found:
in module $PSCI
at line 1, column 1 - line 1, column 12
Unknown module Array
See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,
or to contribute content related to this error.
> Map.lookup "a" $ Map.singleton "a" 5
Error found:
in module $PSCI
at line 1, column 1 - line 1, column 11
Unknown module Map
See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,
or to contribute content related to this error.
I was able to get it working by adding the following to my real snippet.... should this be included in the recommended snippet for the book?
import Data.Array as Array
import Data.Map as Map
Yes, I messed up by not listing imports. I'll fix that chapter in the next release.