last3::[a]-> Maybe a; last3 [] = Nothing last3 ([a]) = Just a last3 (_:xs) = last3 xs Notice that the last case will never be executed, as the matching is complete with the first two case.