IHP v1.1.0 has been released 🎉

I’m happy to announce that IHP v1.1.0 is out now! This release brings some large improvements to the dev environment by integrating devenv.sh, adds native GPT4 support through ihp-openai and much more.

You can find the full change log on GitHub

Here’s a summary of what’s new:

devenv.sh x IHP:

IHP projects now use devenv.sh. devenv is a wrapper around nix flakes that provides fast, declarative, reproducable and composable development environments. It supercedes the previous .envrc approach. Especially projects with lots of dependencies are much faster to open with devenv.

ihp-openai:

The new ihp-openai package adds an easy way to integrate GPT3 and GPT4 to your Haskell web apps. The library is extracted from a production app at digitally induced. Compared to existing haskell libs this library is a streaming API (so works great with IHP AutoRefresh and IHP DataSync), works with the latest Chat API, and has smart retry on error without throwing away tokens. Also it’s battle tested in real world production use cases.

The package can be found in the IHP repo and a demo project can be found on GitHub as well.

Here’s a demo video of GPT-3.5 and IHP AutoRefresh:

video preview

New Functions: onlyWhere, onlyWhereReferences and onlyWhereReferencesMaybe:

In IHP code bases you often write filter functions such as these:

\ 387xauto

This can be written in a shorter way using onlyWhere:

\ 387xauto

Check the full change log to see what you can do with onlyWhereReferences and onlyWhereReferencesMaybe.

GHC 9.2.4 → 9.4.4

We’ve moved to a newer GHC version :+1:

Initalizers

You can now run code on the start up of your IHP app using an initializer. For that you can call addInitializer from your project’s Config.hs.

The following example will print a hello world message on startup:

\ 387xauto

This is especially useful when using IHP’s Row level security helpers. If your app is calling ensureAuthenticatedRoleExists from the FrontController, you can now move that to the app startup to reduce latency of your application:

\ 507xauto

Multiple Record Forms

You can now use nestedFormFor to make nested forms with the IHP form helpers. This helps solve more complex form use cases.

Here’s a code example:

\ 800xauto

Faster Initial Startup for large IHP Apps:

The Generated.Types module is a module generated by IHP based on your project’s Schema.sql. The module is now splitted into multiple sub modules, one for each table in your Schema.sql. This makes the initial startup of your app faster, as the individual sub modules can now be loaded in parallel by the compiler.

Static Files Changes:

IHP is now using the more actively maintained wai-app-static instead of wai-middleware-static for serving files from the static/ directory.

The old wai-middleware-static had some issues, particular related to leaking file handles. Also wai-app-static has better cache handling for our dev mode.

.env Files:

Next to the .envrc, you can now save secrets outside your project repository by putting them into the .env file.
The .env is not committed to the repo, so all secrets are safe against being accidentally leaked.

HSX Comments:

You can now write Haskell comments inside HSX expressions:

\ 476xauto

HSX Doctype:

HTML Doctypes are now supported in HSX. Previously you had to write them by using the underlying blaze-html library:

\ 300xauto


Check out the full change log on GitHub
Or check out the Upgrade instructions

13 Likes