Multiple declarations error even with DuplicateRecordFields


I am using servant and persistent to define quite a lot of data types, while running stack build, I have error of Multiple declarations of a data type, I already have {-# LANGUAGE DuplicateRecordFields #-}, still getting this error. Search didn’t find more solution, any idea to resolve this?

My lts is 14.17, building on WSL Ubuntu 18.04



Hi @tdxiong, perhaps you could reduce your code to a smaller example and post that here, so we can help you out? It’s hard to tell what’s going wrong if we can’t see the code.


My models are in seperate files for code organization. While thinking about how to put code here, seperate files came to my mind, I just added {-# LANGUAGE DuplicateRecordFields #-} to one file only after encountering this error, now I added it to all model files, no error then.