I do this all the time. In your stack.yaml file add the path to the Foo package:
-- stack.yaml packages: - '.' - lib/foo
And then in your Bar.cabal file you say that your build depends on Foo
-- project.cabal ... build-depends: base >= 4.7 && < 5 , foo
source share