isPrefixOf & isSuffixOf Please review and suggest improvements for my isPrefixOf implementation.

isPrefixOf' :: (Eq a) =&gt; [a] -&gt; [a] -&gt; Bool
isPrefixOf' [] _ = False
isPrefixOf' _ [] = False
isPrefixOf' (x:xs) (y:ys) 
  | null xs &amp;&amp; x == y = True
  | x == y            = isPrefixOf' xs ys
  | otherwise         = False


Also, I wrote isSuffixOf baesd on isPrefixOf. It seems debatable to me whether it's clear to understand. Is it idiomatic?

isSuffixOf' :: (Eq a) =&gt; [a] -&gt; [a] -&gt; Bool
isSuffixOf' xs ys = isPrefixOf' (reverse xs) (reverse ys)

--isSuffixOf "foobar" "bar" == isPrefixOf "raboof" "rab"
That is very idiomatic Haskell code. The only thing I'd mention is that the empty list is a prefix of everything, so your first case should be

isPrefixOf' [] _ = True


With that change, you can remove

  | null xs &amp;&amp; x == y = True


since it will be correctly handled by

  | x == y = isPrefixOf' xs ys


As for implementing isSuffixOf in terms of inPrefixOf, you're in good company; that's how Data.List does it.