小编Fen*_*ong的帖子

haskell列表列出模式匹配

这是我的代码:

newcell :: [Cell] -> [Cell]
newcell [Cell {cellPosition = cp, cellState = cs}] 
= [Cell {cellPosition = cp, cellState = (nextCellState cs)}]
Run Code Online (Sandbox Code Playgroud)

nextCellState 只是一个功能,但它说不能匹配模式.

src/StudentSources/LangtonsAnt.hs:141:1: Warning:
Pattern match(es) are non-exhaustive
In an equation for ‘newcell’:
    Patterns not matched:
        []
        (Cell _ _) : (_ : _)
Run Code Online (Sandbox Code Playgroud)

haskell

0
推荐指数
1
解决办法
58
查看次数

标签 统计

haskell ×1