Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell 文本‘;1’;_Haskell_Types_Functional Programming - Fatal编程技术网

Haskell 文本‘;1’;

Haskell 文本‘;1’;,haskell,types,functional-programming,Haskell,Types,Functional Programming,•没有由文字“1”产生的(Num[Integer])实例 •在“(==)”的第二个参数中,即“1” 在“(&&&)”的第二个参数中,即“(保持==1)” 在表达式中:(x==0)和&(reside==1)您的类型签名表示reside应该是:[Integer],但您将其与=到1与isInteger进行比较。也许您的类型签名的目的是plus1::[Integer]->Integer->[Integer]您的类型签名说resident应该是[Integer],但您将其与=与1与isInteger进行比

•没有由文字“1”产生的(Num[Integer])实例

•在“(==)”的第二个参数中,即“1”

在“(&&&)”的第二个参数中,即“(保持==1)”


在表达式中:(x==0)和&(reside==1)

您的类型签名表示
reside
应该是
:[Integer]
,但您将其与
=
1
与is
Integer
进行比较。也许您的类型签名的目的是
plus1::[Integer]->Integer->[Integer]

您的类型签名说
resident
应该是
[Integer]
,但您将其与
=
1
与is
Integer
进行比较。也许
remain
的类型签名是
plus1::[Integer]->Integer->[Integer]
?非常感谢您从Mateusz的评论中抽出时间来回答这个问题。
plus1 :: [Integer] ->  [Integer] -> [Integer] 
plus1 (x:xs) remain  
    | (x==0) && (remain==1) = [1] ++ (plus1 xs (remain-1) )
    | (x==1) && (remain==1) = [0] ++ (plus1 xs remain)
    | (x==0) && (remain==0) = [0] ++ (plus1 xs 0)
    | (x==1) && (remain==0) = [1] ++ (plus1 xs 0)
    |  otherwise = []