Servant[1] allows you to create type-safe APIs, and there are many libraries that allow you to define your HTML in a type-safe way.
The Haskell wiki lists some other frameworks: https://wiki.haskell.org/Web/Frameworks
[1] https://hackage.haskell.org/package/servant