Skip to content

v0.20.0

Compare
Choose a tag to compare
@mpscholten mpscholten released this 30 Aug 08:51
· 1133 commits to master since this release

IHP v0.20.0 is out now

A new IHP release, containing bug fixes and productivity improvements to existing features πŸ› οΈ

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.

Major Changes

  • βšͺ Dot Notation:
    IHP goes OOP-ish. Thanks to a compiler update in this release we can now make use of dot notation Γ  la someThing.someAttribute πŸŽ‰

    -- Previously:
    get #title project
    
    -- Now:
    project.title

    This also works in HSX:

    [hsx|
        <!-- Previously: -->
        <div>{get #title project}</div>
    
        <!-- Now: -->
        <div>{project.title}</div>
    |]

    This can especially be useful when you're dealing with nested records, e.g. when working with fetchRelated:

    [hsx|
        <!-- Previously: -->
        <div>{get #name (get #userId project)}</div>
    
        <!-- Now: -->
        <div>{project.userId.name}</div>
    |]
  • πŸ› οΈ HSX Improvements:
    We've refactored HSX to fix some of the common issues, like HSX not support expressions like allEnumValues @MyEnum. This refactoring was needed to make dot notation work in HSX as well.

    [hsx|
        <!-- Previously failed because of the @ symbol: -->
        {allEnumValues @Color}
    
        <!-- Just works with IHP 0.20: -->
        {allEnumValues @Color}
    |]
  • βž• New Function: isActiveAction
    Returns True when the given action matches the path of the currently executed action

    [hsx|
        {isActiveAction PostsAction}
    |]
  • 🌎 I18n Routing:
    As we're preparing I18n support for IHP apps, we've already refactored the routing to support langauge prefixes, e.g. /de/ for a german site and /en/ for english.

    Here's an advanced code example of this in action:

    instance FrontController WebApplication where
        ... -- the previous code assigning controllers is still required
    
        router additionalControllers = do
            mlocale <- optional do
                string "/"
                string "en"
    
            let router = defaultRouter additionalControllers
    
            case mlocale of
                Just locale -> case locale of
                    "en" -> putContextRouter EN_UK router
                    _ -> IHP.RouterPrelude.error "This should be unreachable"
                Nothing -> router

    Once IHP has full i18n, you can find more on this in the documentation.

  • πŸ€– GHC 9.2.4:
    We've updated to a new major version of GHC. Previously IHP apps were using GHC 8.10.7. This improves support for M1/M2 macs and allows for dot notation.

Other Changes

Full Changelog: v0.19.0...v0.20.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.