A haskell learning exercise based on alternative