为什么我会收到此错误(因使用'print'而引起)

时间:2017-11-13 21:55:50

标签: haskell ghci

我做了类似的事情:

data Peca = Peca Tipo Altura
  deriving (Eq,Read,Show) 

type Altura = Int 

data Tipo = Rampa Orientacao | Curva Orientacao | Recta | Lava
  deriving (Eq,Read,Show)

isLavva:: [Peca] -> Tipo -> [Peca]
islavva [] _ = []
isLavva ((Peca h a):t) x |h==x = (Peca h a):isLavva t x
                         |otherwise = isLavva t x

不要介意葡萄牙语中的名字...当我尝试isLavva [Peca Lava 0]它只是说

isLavva [Peca Lava 0,Peca Lava 0,Peca Recta 0]

<interactive>:45:1:
No instance for (Show (Tipo -> [Peca]))
  (maybe you haven't applied enough arguments to a function?)
  arising from a use of ‘print’
In a stmt of an interactive GHCi command: print it

0 个答案:

没有答案