ported file comparison fn to Haskell