getPara :: (Num [Char]) => [Char] -> Integer -> [Char]
getPara "" _ = ""
getPara str nr
| (nr == 0 ) && ((head str) == ')' ) = ')' : getPara "" 0
| ( nr == 0 ) && ( (head str) == '(' ) = '(' : (getPara (tail str) 0)
| (nr /= 0 ) && ( (head str) == '(') = (getPara (tail str) nr-1)
| (nr == 0 ) && ( (head str) /= '(' ) = (head str) : (getPara (tail str) 0 )
| otherwise = (getPara (tail str) nr)
我想要做的是从字符串中获取 nr 组括号,我得到的错误是:
Illegal Haskell 98 class constraint in type declaration
*** Expression : getPara
*** Type : Num [Char] => [Char] -> Integer -> [Char]
问题是什么?