there's kind of a ladder of complexity, where you have safety vs complexity vs how much to learn vs what the lib does for you.
hasql and postgresql-simple have a 1 on safety and "what the lib does for you" but also have a 1 on complexity and how much to learn. if you know SQL, you can write raw string queries. But you also don't get any safety or migrations or composability.
persistent is a 2 on the "how much to learn", and around a 3 on "how much it does for you." You get migrations, datatype definitions, very safe easy/common-case functions. The functions it gives you are perfectly safe, but you need to use esqueleto or raw SQL for fancy stuff so it's like 3 on safety. There's not a huge amount to learn, maybe it's a 2 here.
esqueleto is a lot more powerful, but requires a lot more learning - so it's like a 4 on what it does for you and a 3 on how much to learn. It's not perfectly safe, but it does more safely than persistent, so it gets a 4.
beam is complicated and difficult to learn. It has a 5 on how m