Simple Haskell program causes 'Illegal signature in pattern' error

Viewed 3969

I've decided to teach myself Haskell and I have never been so frustrated in all my life. I am going through the tutorial at http://lisperati.com/haskell/ which is the easiest one I could find. All that I am trying to do is read a text file called people.txt which contains a list of numbers and print the length of the list. This code is straight from the tutorial.

import Data.List

type Person = [Int]

main = do

    people_text <- readFile "people.txt"
    let people :: [Person]
            people = read people_text

    putStr "Number of people "
    putStr (length people_text)

When I try to run the file with runHaskell tutorial03.hs I get this error message

tutorial03.hs:9:13:
Illegal signature in pattern: [Person] people
    Use -XScopedTypeVariables to permit it

Using the XScopedTypeVariables flag I get

tutorial03.hs:10:17: Not in scope: type variable `people'

Could someone please explain what I am doing wrong.

2 Answers
Related