Suppose you have the following modules:
-- Schema/Foo.hs
module Schema.Foo where
mkPersist $(persistFileWith "foo.persistentmodels")
-- foo.persistentmodels
Foo
name Text
Primary name
-- Schema/Bar.hs
module Schema.Bar where
import Schema.Foo
mkPersist $(persistFileWith "bar.persistentmodels")
-- bar.persistentmodels
Bar
foo Text
Foreign Foo fk_bar_to_foo foo
This code will currently fail, because the HaskellName "Foo" is not present in the EmbedEntityMap, because it was not parsed from the same block of text.
I think there needs to be some way to lookup the entity without requiring it be present in the map. Attempting to call entityDef (Nothing :: Maybe $(Foo)) instead of relying on what's in the Map might work.
Suppose you have the following modules:
This code will currently fail, because the
HaskellName "Foo"is not present in theEmbedEntityMap, because it was not parsed from the same block of text.I think there needs to be some way to lookup the entity without requiring it be present in the map. Attempting to call
entityDef (Nothing :: Maybe $(Foo))instead of relying on what's in theMapmight work.