General

IHP Release: 21.08.2020 (v21082020)

We've just released a new IHP version! :)

Major Changes

  • Numeric Primary Keys Supported: IHP now allows numeric (Serial in Postgres-speak) primary keys. Previously only UUIDs have been supported. UUIDs will still be the default. This feature makes it more simple to use IHP with existing databases and services.
  • nl2br: A new view helper has been added in this release. With nl2br you can transform \n linebreaks to <br> line breaks. Like get #body post |> nl2br :)
  • HTML Comments: HSX now supports HTML comment syntax. <!-- 🚀 -->. This has been added after someone asked for comment syntax on Stack Overflow. This was actually the first IHP-related stack overflow question we've come across.

Other Changes

Updating

To update the IHP version of your project, open default.nix and change the git commit in line 4 to the following:

rev = "0bb881e0febdf5fb8db939a6c5eb481c76a1b332";

After that run the following command to update your project:

nix-shell -j auto --cores 0 --run 'make -B .envrc'

In case nix starts rebuilding IHP (might take a while), make sure cachix is set up as expected:

cachix use digitallyinduced

Now you can start your project as usual with ./start.

If you have any problems with updating, let us know on the brand new IHP forum.

📧 To stay in the loop, subscribe to the IHP release emails. Or follow digitally induced on twitter..

📅 The next release is expected to be released on 04.09.2020.

If you're curious what we're also working on, click here 🔥

marc , in General
IHP Release: 04.09.2020 (v20200904)

It's time for the next release of IHP: 20200904 🎉

Major Changes

  • Composite Primary Key Support: You can now use tables that have a primary key consisting of multiple columns. This helps you to handle complex database schemas with IHP. To use this new feature, just define a composite PK in your Schema.sql like this:
CREATE TABLE order_trucks (
    order_id BIGSERIAL NOT NULL,
    truck_id BIGSERIAL NOT NULL,
    PRIMARY KEY(order_id, truck_id)
);

This feature has been contributed by @ruhatch 🎉

  • Improved Error Screen when a request parameter is missing: Errors caused by calls to param now have a beautiful error screen telling you about what do next. It also displays all submitted params, so you can quickly spot whether there was a typo.

Other Changes

- The primary haskell json library aeson is now exported by the ViewPrelude by default. No need to manually import it in your views anymore. - A code generation issue caused by having a table with two foreign keys referencing the same foreign table has been fixed. - An issue encoding with enums using multibyte characters has been resolved - The CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; is not required in your app's Schema.sql anymore. It's automatically loaded by IHP. - Support for empty attributes in HSX like <input disabled/> has been added. - Grammar fixes - The make target build/bin/RunOptimizedProdServer now correctly depends on build/Generated/Types.hs. The target build/bin/RunUnoptimizedProdServer already has this dependency. - Dotless Emails are now validated correctly - All IHP binaries are now compiled with -threaded. Somehow we missed this. This improves the performance of the dev server. - The default ghci prompt of a IHP is now a lambda symbol - make targets for compiling IHP scripts have been added - a naming issue causing request not being easily useable in actions has been resolved

  • The release versioning scheme has changed from vDDMMYYYY to vYYYYMMDD starting with this version.

Updating

To update the IHP version of your project, open default.nix and change the git commit in line 4 to the following:

rev = "a12a1ce8f16814b802aae39eb26a9d3247192c12";

After that run the following command to update your project:

nix-shell -j auto --cores 0 --run 'make -B .envrc'

Now you can start your project as usual with ./start.


In case you get a compiler error about a missing field in ModelContext in the auto-generated build/Generated/Types.hs please stop your application and do a clean rebuild:

make clean
nix-shell -j auto --cores 0 --run 'make -B .envrc'
./start

If you have any problems with updating, let us know on the brand new IHP forum.

📧 To stay in the loop, subscribe to the IHP release emails. Or follow digitally induced on twitter..

📅 The next release is expected to be released on 18.09.2020.

Also a short update on IHP Cloud: We're sending out the first IHP Cloud invites in the coming days 🔥

marc , in General
HSX: Conversion from Action to Route through ToHtml?

I started learning IHP and after finishing the "Your first project" part in the IHP Guide, I saw how actions where used as routes in two ways:

  • <a href={pathTo NewPostAction}><...
  • <a href={ShowPostAction}><...

Changing any of them to the other breaks neither of them

Now, looking at the HSX Guide, it states:

"If the variable is any other custom Haskell data structure: it will first be converted to a string representation by calling show on it. You can add a custom ToHtml (import it from IHP.HtmlSupport.ToHtml) instance, to customize rendering a data structure."

As I looked at the ToHtml class, I reasoned it should probably work in the way, that if there is no ToHtml Instance for a "custom haskell data structure", it will just use the Show instance of ToHtml, which is derived for any generated Controller Actions. I figured, this must mean in the conversion process from hsx to html, there is no explicit use of Show but ToHtml is used for any data, defaulting to its Show instance.

If I'm right, does that mean, that there are generated ToHtml instances for the Controller Actions, which would convert them? A derived Show instance of a normal algebraic data structure would just return the typical string representation said structures, so there must be a conversion to a href-compatible path. I couldn't find the ToHtml instances, but still with or without pathTo, the action gets translated to a path in HSX(Maybe I'm wrong here?). pathTo's usage would be to manually change a path, and if no change of the path is needed, one can just write "{Action}" to get the standard path to it.

Maybe I misunderstand something crucial here, and I would be happy to change that. My future self thanks you!

smorfer , in General
New Release: Beta 18.09.2020

It's time for the next release of IHP: 20200918 🎉

Major Changes

Other Changes

Updating

To update the IHP version of your project, open default.nix and change the git commit in line 4 to the following:

rev = "0575a933331d45782ed732a5437ead377e165b29";

After that run the following command to update your project:

nix-shell -j auto --cores 0 --run 'make -B .envrc'

Now you can start your project as usual with ./start.


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. Or follow digitally induced on twitter..

📅 The next release is expected to be released on 02.10.2020.

Also a short update on IHP Cloud: We've been busy onboarding new users the last couple of days :) The first apps deployed to IHP Cloud look really cool. We're super excited 🚀

marc , in General
IHP Release: 02.10.2020

It's time for the next release of IHP: v20201002 🎉

Major Changes

Other Changes

- The image upload recipe has been extended to document how the form needs to look when doing image uploads. - Login error messages are now Invalid credentials - Generated.Types is imported by default in the empty Layout.hs - The Contributing documentation now explains how to run the IHP tests - A bug where the FrontController.hs was generated twice was fixed - The version of morphdom used by IHP has been updated - A new textToId function has been added to simplify conversion of text or bytestrings to db ids - Missing documentation on fetchCount has been added - New recipe: How to generate a random string - New function: sqlQueryScalar similiar to sqlQuery but returns a scalar value - Fixed scripts not working in dev mode - Fixed awk warning when running make static/prod.js

Updating

To update the IHP version of your project, open default.nix and change the git commit in line 4 to the following:

rev = "c4d2815f064c055cd957389a4df5eab25294dba3";

After that run the following command to update your project:

nix-shell -j auto --cores 0 --run 'make -B .envrc'

Now you can start your project as usual with ./start.


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. Or follow digitally induced on twitter..

📅 The next release is expected to be released on 16.10.2020.

If you haven't looked already, check out the IHP Auto Refresh Demo 🚀

marc , in General
IHP Release: 16.10.2020

It's time for the next release of IHP: v20201016 🎉

Major Changes

Other Changes

Updating

This release requires a few more steps than usual. As we've changed the nixpkgs version, this will also require a lot of redownloading of all packages. Make sure you have good internet and can wait up to 30 minutes to complete the download. We highly suggest to make sure your coffee machine is working before starting the update.

First open default.nix and change the git commit in line 4 to the following:

rev = "49816c21d34fd7894a956bf7fd997e6ed5243acf";

Open Config/nix/nixpkgs-config.nix and replace the file with this new version: https://raw.githubusercontent.com/digitallyinduced/ihp-boilerplate/81518e9b66e1e9d3bdf40affa674a7d2cd63f414/Config/nix/nixpkgs-config.nix

After that run the following command to update your project:

# Be aware that this will redownload a lot of files and take lots of time
nix-shell -j auto --cores 0 --run 'make -B .envrc'
make -B build/ihp-lib

# This step is required to get the config files for haskell-language-server
make hie.yaml

Now you can start your project as usual with ./start.

Check out the docs to get started with haskell language server to get cool IDE features.


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. Or follow digitally induced on twitter..

📅 The next release is expected to be released on 30.10.2020.

marc , in General