TU-CSCI2322-FL24 / solver-connect-gore

solver-connect-gore created by GitHub Classroom
0 stars 0 forks source link

avoid refutable pattern matching #11

Open sfogarty opened 6 hours ago

sfogarty commented 6 hours ago

in makeMove you match (leftCols, column:rightCols) = splitAt move board, but if the move is out of bounds that will crash your entire program. Instead, you should use a case expresssion

case splitAt move board of
    (leftCols, column:rightCols) -> let updatedColumn = ....
    _ -> error "invalid move" -- or Nothing if you do story 6