Fix dependencies and add Applicative and Functor instances