On Mon, Nov 10, 2014 at 12:04 AM, Max Voit <max.voit+mlhc@with-eyes.net> wrote:
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.

Lists are tricky because of the special syntax.

The first case is [] or Nil, the second is [a] which is equivalent to (a:[]).

Hence there's a remaining case of a Cons cell (:) that's NOT followed by Nil ([]), which is the third case.

-- Kim-Ee