I'm working on a function to read a list for user input and then create a tree from it. Here's the code
readList : IO (Maybe BSTree a)
readList = do x <- getLine
if all isDigit (unpack input)
then do (_ ** xs) <- readList
pure ( listToTree (cast x)::xs )
else pure Nothing
This is the type definition of listToTree
listToTree : Ord a => List a -> BSTree a
In type-checking readList, I get an error of "unexpected pure" in the pure ( listToTree (cast x)::xs )
line. Is this an indentation issue? Why isn't the pure keyword taking here?