I’ve been working with PureScript for a little over a week now and basic things are still causing problem for me, such as setting up a new project and implementing a simple, working Main.purs that compiles. I found a great guide on this forum that describes the best tooling to use as of 2019. Following this document, I am now doing the following to set up:
yarn spago init yarn spago run yarn spago install maybe yarn spago install lists yarn spago install strings yarn spago build
So this works ok, until I actually try to write code in VS Code. A simple example:
module Main where import Prelude import Effect (Effect) import Effect.Console (log) import Data.Maybe import Data.List as List import Data.String as String main :: Effect Unit main = do isPangram "Just a string." log "🍝" isPangram :: Maybe String -> Boolean isPangram Nothing = false isPangram string = let alpha_list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] in innerPangram fromMaybe string alpha_list 0 innerPangram :: Maybe String -> List -> Int -> Boolean innerPangram _  _ = true innerPangram input list cur = let lower_input = String.toLower input in if List.elemIndex input[cur] list then true -- if Set.empty the_set -- if not Set.empty alpha_set cur then -- if Set.member then -- alpha_set = Set.delete alpha_set lower_input[cur] else innerPangram input alpha_set
I then attempt to run
yarn spago build and start getting unexpected errors, like:
yarn run v1.22.4
warning package.json: No license field
$ /home/me/Documents/projects/codes/purescript/playground/node_modules/.bin/spago build
[info] Installation complete.
in module Main
at src/Main.purs:24:33 - 24:37 (line 24, column 33 - line 24, column 37)
Unknown type List
See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,
or to contribute content related to this error.
[error] Failed to build.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
As far as I can tell, I’m following the docs, but I just keep getting problems like this and it’s super frustrating.
Could someone please tell me what I am doing wrong? Thanks.