Haskell中模式匹配的错误

use*_*947 0 haskell pattern-matching parse-error

我正在编写一个函数,将bool列表的列表无意义地映射到bool列表中.这是我的代码:

y=[False| y<-[0..]]    
encode :: [[Bool]] -> [Bool]
encode x:xs =   (zip1 x y):True:True:(encode xs)
encode []=[]
Run Code Online (Sandbox Code Playgroud)

zip1函数只需要两个列表并将它们交替写入新列表.

我收到错误消息

模式中的解析错误:编码

为什么我收到此错误消息?

Joh*_*man 5

函数应用程序的优先级高于 :

因此,Haskell解析

encode x:xs 
Run Code Online (Sandbox Code Playgroud)

(encode x):xs 
Run Code Online (Sandbox Code Playgroud)

这毫无意义.你需要

encode (x:xs) 
Run Code Online (Sandbox Code Playgroud)