v1.1.0 #1767
mpscholten
started this conversation in
General
v1.1.0
#1767
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
IHP is a modern batteries-included haskell web framework, built on top of Haskell and Nix. Blazing fast, secure, easy to refactor and the best developer experience with everything you need - from prototype to production.
This release brings some large improvements to the dev environment by integrating devenv.sh, adds native GPT4 support through ihp-openai and much more.
Major Changes
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
.envrcapproach. Especially projects with lots of dependencies are much faster to open with devenv.ihp-openai:
The new
ihp-openaipackage 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.
Example:
Bildschirmaufnahme.2023-04-17.um.23.48.41.mov
onlyWhere,onlyWhereReferencesandonlyWhereReferencesMaybe:In IHP code bases you often write filter functions such as these:
This can be written in a shorter way using
onlyWhere:Because the
userIdfield is an Id, we can useonlyWhereReferencesto make it even shorter:If the Id field is nullable, we need to use
onlyWhereReferencesMaybe:GHC 9.2.4 -> 9.4.4
We've moved to a newer GHC version 👍
Initalizers
You can now run code on the start up of your IHP app using an initializer. For that you can call
addInitializerfrom your project'sConfig.hs.The following example will print a hello world message on startup:
This is especially useful when using IHP's Row level security helpers. If your app is calling
ensureAuthenticatedRoleExistsfrom theFrontController, you can now move that to the app startup to reduce latency of your application:Multiple Record Forms
You can now use
nestedFormForto make nested forms with the IHP form helpers. This helps solve more complex form use cases.Here's a code example:
You can find a demo app here.
Faster Initial Startup for large IHP Apps:
The
Generated.Typesmodule is a module generated by IHP based on your project'sSchema.sql. The module is now splitted into multiple sub modules, one for each table in yourSchema.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-staticinstead ofwai-middleware-staticfor serving files from thestatic/directory.The old
wai-middleware-statichad some issues, particular related to leaking file handles. Alsowai-app-statichas better cache handling for our dev mode.You might see some changes related to caching of your app's static files:
static/vendor/previously had more aggressive caching rules, this is not supported anymore.maxage=0instead ofCache-Control: nocacheasssetPathhelper, this will not cause any issues.Additionally the routing priority has changed to save some syscall overhead for every request:
Previously:
Now:
.envFiles:Next to the
.envrc, you can now save secrets outside your project repository by putting them into the.envfile.The
.envis 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:
HSX Doctype:
HTML Doctypes are now supported in HSX. Previously you had to write them by using the underlying blaze-html library:
Minor Changes
accessDeniedWhenNotable Documentation Changes
Full Changelog: v1.0.0...v1.1.0
Feature Voting
Help decide what's coming next to IHP by using the Feature Voting!
Updating
→ See the UPGRADE.md for upgrade instructions.
If you have any problems with updating, let us know on the IHP forum.
📧 To stay in the loop, subscribe to the IHP release emails (right at the bottom of the page). Or follow digitally induced on twitter.
This discussion was created from the release v1.1.0.
Beta Was this translation helpful? Give feedback.
All reactions