Skip to content

v0.18.0 (Beta 25.01.2022)

Compare
Choose a tag to compare
@mpscholten mpscholten released this 25 Jan 06:41
· 1560 commits to master since this release

IHP v0.18.0 is out now

A new IHP release, mostly containing bug fixes and productivty 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

  • πŸšͺStripe Cancelations are Supported now:
    The IHP Stripe Integration now supports two further events that allow your app to automatically handle with unsubscribes:

        on CustomerSubscriptionUpdated { subscription = stripeSubscription } = do
            -- ...
        on CustomerSubscriptionDeleted { subscriptionId } = do
            -- ...

    Learn how to handle unsubscribes in the docs.

  • 🧰 Haskell Language Server: Performance Improvements
    The Haskell Language Server provided by IHP is now compiled with the --enable-executable-dynamic flag. This flag significantly improved performance of using HLS in IHP code bases as reported by multiple people.

    If you still have performance issues, please submit issues directly here haskell/haskell-language-server#2340

  • πŸͺ Cookies:
    While IHP had supported session cookies for a long time now, we never got to add a simple function to add your own non-session cookies. Now it's finally there, meet setCookie:

    import Web.Cookie
    
    action MyAction = do
        setCookie defaultSetCookie
                { setCookieName = "exampleCookie"
                , setCookieValue = "exampleValue"
                }
  • πŸ“ƒ Multi-line Strings:
    IHP apps now have [trimming|some text|] in scope by default. This trimming quasi quoter provides a useful way to write multi line strings, like this:

    let myString = [trimming|
        My
        multi line
        string
    |]

    It's called trimming because the function automatically trims/removes the indentation spaces at the left. So the above string is My\nmulti line\nstring instead of <4 spaces>My\n<4 spaces>multi line\n<4 spaces>\nstring.

  • πŸ“« Mail Improvements:
    You can now easily set reply-to, cc, bcc or custom headers when using the IHP Mailer system:

    instance BuildMail ConfirmationMail where
        subject = "Subject"
        to ConfirmationMail { .. } = Address { addressName = Just "F L", addressEmail = "[email protected]" }
        from = "[email protected]"
        html ConfirmationMail { .. } = [hsx|
            Hello World
        |]
    
        -- New:
    
        replyTo ConfirmationMail { .. } =
            Just Address { addessName = "Support", addressEmail = "[email protected]" }
        
        cc ConfirmationMail { .. } =
            [ Address { addessName = "Some one", addressEmail = "[email protected]" } ]
        
        bcc ConfirmationMail { .. } =
            [ Address { addessName = "Some one", addressEmail = "[email protected]" } ]
    
        -- Custom headers
        headers ConfirmationMail { .. } =
            [ ("X-Mailer", "mail4j 2.17.0")
            , ("In-Reply-To", "<[email protected]>")
            ]
  • πŸ—‘οΈ deleteRecordByIds
    You can now easier delete records when you only know their ids:

    let postId :: [Id Post] = ["5280e9a5-3105-45b3-8aea-6a081c596a11", "6761216b-c508-4c88-80fc-66316a1dc88c"]
    deleteRecordByIds postId
  • πŸ†• fetchLatest
    There's now a helper to fetch latest record of something:

    latestUser <- query @User |> fetchLatest
    
    -- Previously you had to write query:
    latestUser <- query @User
            |> orderByDesc #createdAt
            |> fetchOneOrNothing

Other Changes

Full Changelog: v0.17.0...v0.18.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.