Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHAPTER 1] Array.index does not appear to exist? #2

Open
cowboyd opened this issue Aug 8, 2018 · 2 comments
Open

[CHAPTER 1] Array.index does not appear to exist? #2

cowboyd opened this issue Aug 8, 2018 · 2 comments

Comments

@cowboyd
Copy link

cowboyd commented Aug 8, 2018

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.
@cowboyd
Copy link
Author

cowboyd commented Aug 8, 2018

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

@marick
Copy link
Owner

marick commented Aug 8, 2018

Yes, I messed up by not listing imports. I'll fix that chapter in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants