小编use*_*678的帖子

没有明确的实施警告

我像这样定义了一个类Stack

class Stack stack where
  push :: a -> stack a -> stack a
  top :: MonadPlus m => stack a -> m (a,stack a)
  empty :: stack a
  isEmpty :: stack a -> Bool
Run Code Online (Sandbox Code Playgroud)

但是当我实施这些方法时

instance Stack [] where
push b bs = b:bs
top [] = mzero
top (b:bs) = return(b,bs)
empty = []
isEmpty [] = True
isEmpty _ = False
Run Code Online (Sandbox Code Playgroud)

我收到这个警告:

Warning: No explicit implementation for
  `Types.push', `Types.top', `Types.empty', and `Types.isEmpty'
In the instance declaration for …
Run Code Online (Sandbox Code Playgroud)

warnings haskell compiler-warnings ghc

2
推荐指数
1
解决办法
983
查看次数

标签 统计

compiler-warnings ×1

ghc ×1

haskell ×1

warnings ×1