Error in Purescript in running Palindrome List code

Ran below code for palindrome list, however got error.

Note had installed list before running code with command (spago install lists control maybe)

Code

module Main where

import Prelude
import Effect (Effect)
import Effect.Console(logShow)

import Data.List(null, tail, head)
import Data.Maybe(maybe)

reverseList :: forall a. List a → List a
reverseList arr =
if null arr
then Nil
else reverseList (tail arr) append (Cons (head arr) Nil)

isPalindrome :: forall a. Eq a => List a → Boolean
isPalindrome arr =
arr == reverseList arr

main :: Effect Unit
main = do
let palindrome = [1, 2, 3, 2, 1]
let nonPalindrome = [“hello”, “world”]
logShow (isPalindrome palindrome)
logShow (isPalindrome nonPalindrome)

Error

Error 1 of 2:

in module Main
at src\Main.purs:11:26 - 11:30 (line 11, column 26 - line 11, column 30)

Unknown type List

See documentation/errors/UnknownName.md at master · purescript/documentation · GitHub for more information,
or to contribute content related to this error.

Error 2 of 2:

in module Main
at src\Main.purs:17:35 - 17:39 (line 17, column 35 - line 17, column 39)

Unknown type List

See documentation/errors/UnknownName.md at master · purescript/documentation · GitHub for more information,
or to contribute content related to this error.

You’ll have to import the Datatype List from the module Data.List as well.
So change
import Data.List (null, tail, head)
to
import Data.List (List, null, tail, head)

1 Like