Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Sascha Gresk
    ah thanks - have been in the garden … the weather was amazing - will watch this !!
    Hello, I'm trying to debug an issue in prod, I recently added authentication to my app, but I can't seem to create a user in prod, when locally it works perfectly
    app link: https://retros.ihpapp.com
    source code: https://github.com/rametta/retros
    I can't see the logs in ihp cloud so not sure what the issue could be. I added a migration script to delete all my data just in case it was causing problems, but didn't seem to help
    15 replies
    Hi, I have an IHP index view with a tabular listing of certain db entries. Every line in the listing has a link which toggles one particular boolean option for the given db record and then redirects back to the listing (all via a controller action). Unfortunately the option is toggled already when one hovers with the cursor over the link. I guess, it has sth. to do with turbolinks or instantclick? Any suggestions how to deal with this problem?
    1 reply
    awesome. thanks!
    works. thanks again.
    Fritz Feger

    Hello everybody! I've followed https://ihp.digitallyinduced.com/Guide/routing.html#beautiful-urls, at least I think so, and the compiler complains:

    Web/View/Posts/Index.hs:7:34Couldn't match type ‘Id' "posts" with ‘Maybe (Id' "posts")’
            arising from a use of ‘renderPost’
        • In the second argument of ‘forEach’, namely ‘renderPost’
          In the first argument of ‘toHtml’, namely
            ‘((forEach posts) renderPost)’
          In the expression: toHtml ((forEach posts) renderPost)
    7 |     html IndexView { .. } = [hsx|
      |                                  ^...

    There was an error before, which disappeared when, in Web/Types.hs, I substituted the ShowPostAction parameter for the URL slug from the Guide { postId :: !(Maybe (Id Post)), slug :: !(Maybe Text) } in all other actions as well.

    For what it's worth, the repo is at https://gitlab.com/fritzfeger/ff-com, and in the README you'll also find the IHP cloud link to the (working) app just before the changes. View all changes I've made to the working version at fritzfeger/ff-com@d159f7f. THANK YOU!

    Marcos Tirao

    Hello I having problems with selectField form helper. To use for my select button, all users coming for DB. I have the following definitions in my controller a setup this

    users <- query @User |> fetch

    And in my view

    data EditView = EditView { issue :: Issue, users :: [User] }

    instance CanSelect User where
    -- Here we specify that the <option> value should contain a Id User
    type SelectValue User = Id User
    -- Here we specify how to transform the model into <option>-value
    selectValue = get #id
    -- And here we specify the <option>-text
    selectLabel = get #name

    and the form definition is like this

    renderForm issue = formFor issue [hsx|
    {(textField #number)}
    {(textField #summary)}
    {(textField #status)}
    {(checkboxField #isPsa)}
    {(textField #days)}
    {(textField #description)}
    {(textField #customerId)}
    {(selectField #userId users)}

    But it generate the error below

    Web/View/Issues/Edit.hs:29:39: error:
    • Couldn't match expected type ‘[item0]’
    with actual type ‘EditView -> [User]’
    • Probable cause: ‘users’ is applied to too few arguments
    In the second argument of ‘selectField’, namely ‘users’
    In the first argument of ‘toHtml’, namely
    ‘((selectField (fromLabel @"userId")) users)’
    In the expression:
    toHtml ((selectField (fromLabel @"userId")) users)
    29 | renderForm issue = formFor issue [hsx|

    1 reply
    Which could be the problem?.
    Marc Scholten
    There’s now https://github.com/digitallyinduced/awesome-ihp :) If you have some open source IHP project, it would be nice if you could add it to the awesome-ihp list
    Yuriy Lazarev
    I've just installed IHP and HLS in VSCode didn't work because of the unrecognized GHC_OPTIONS pragma. It took me a while to figure out its invalid and then I found this digitallyinduced/ihp#797
    Sascha Gresk
    wow … I have got an
    ```Apr 17 09:57:05 ihplive run_production[512]: error, called at ./Control/AutoUpdate.hs:139:48 in auto-update-0.1.6-JjkGYhbyQZt7zynhU75W78:Control.AutoUpdate
    Apr 17 09:57:07 ihplive run_production[512]: Control.AutoUpdate.mkAutoUpdate: worker thread exited with exception: thread blocked indefinitely in an MVar operation
    6 replies
    I am not able reproduce this (yet)
    Sascha Gresk
    somehow https://ihp.digitallyinduced.com/Guide/routing.html#beautiful-urls starts working for me … I guess this was another day of haskell … going for a walk now ;-)
    Marc Scholten
    great to hear :) what did you do different?
    Sascha Gresk
    I have to investigate what I did
    I renamed postId to maybePostId and made slug TEXT DEFAULT '' NOT NULL
    then I delete some Comments-Stuff from the Tutorial
    Marc Scholten
    maybe you can add these changes to the docs to keep them helpful for future new ihp-ers :)
    Sascha Gresk
    my development server only works when I am not logged in … I broke some features I had before ...
    Sascha Gresk
    having a copy-and-past experience is not easy I would guess - it also depends how far you where going with the tutorial - I made the part with the login and commenting the posts ...
    Marcos Tirao


    I want to customize path for my URL, anyone have a working example to share with me?

    1 reply
    Philip Schönholzer

    Hi, just started IHP and Haskell :blush:
    How would I conditionally render a tag in HSX? Like in React it would be

    <p>Hi {user.name}</p>
    {user.country && <p><small>from {user.country}</small></p>} //How to render this tag only if country is truthy?

    Thanks for the great work!

    10 replies
    Marc Scholten
    Short reminder that in around 2 hours we’ll have our second IHP meetup :) you can find the zoom link on the ihp website
    Marc Scholten
    Was a great meetup today :) Thanks everyone for showing up!

    Hello. I have a question.
    I would like to send an email using a different to email for development and production.
    I tried this:

    to CreateAccountMail { .. } = Address
        { addressName = Just (fullName admin)
        , addressEmail =
            if isDevelopment then
                get #email admin

    but I got the following error:
    Overlapping instances for ConfigProvider context0 arising from a use of 'isDevelopment'
    Can anyone give me a hint for how to proceed?

    10 replies
    Hello, just created my first web app in IHP. How can I embed a view inside another view? I have two views for login and sign up forms, and want to merge them in one big view that render them both on same page with login/signup tabs.
    1 reply

    Hi. I have the following problem:
    I create an enum in the Schema Designer called languages with the values english and german.
    I then click Push to DB and get a success message.
    I then add a new column to the table called bundles with the name set to language and the type set to languages.
    Then, I click on Update DB and get the following error message:

    Open your Fixtures.sql and apply required changes to fix this error. After that try again.
    ERROR: type "languages" does not exist
    ERROR: relation "bundles" does not exist

    Schema.sql looks like this:

    CREATE TABLE bundles (
        {- ... -}
        "language" languages NOT NULL
    CREATE TYPE languages AS ENUM ('english', 'german');
    If I unserstand this correctly, Schema.sql is for constructing the database and Fixtures.sql is just for inserting stuff for local development, right? So the languages type and bundles relation should already exist by the time Fixtures.sql is called.
    Marc Scholten
    change the order so tath CREATE TYPE comes before the CREATE TABLE :)
    i think it’s already fixed on master, but not part of v0.9
    Alright, I'll update to the latest commit and take a look.
    Marc Scholten
    you still need to manaully change the order then
    it will only add the sql statements in the correct order on master
    Alright, DB Update successful. :) Thank you.
    Marc Scholten
    v0.10.0 of IHP is out now! :tada: The new version fully packed with lot's of improvements :)
    Here's what's new: https://github.com/digitallyinduced/ihp/releases/tag/v0.10.0
    Also with this release we've adopted the haskell foundation's code of conduct
    Sascha Gresk
    Hi ! I wrote myself a function for a string like this:
    withoutSuffix string suffix =
    take (length string - length suffix) string
    and it works as expected:
    withoutSuffix "/bla/@@edit" "/@@edit"
    now I am in the middle of Router.hs and take is an "Int-> Data.Attoparsec.Internal.Types.Parser ByteString ByteString"
    the compiles says: The function take' is applied to two arguments but its typeInt -> Data.Attoparsec.Internal.Types.Parser ByteString ByteString’ has only one
    and it makes sense to me :-)
    12 replies

    I have another issue.
    I see the following error in the logs on IHP Cloud:

    Incompatible {errSQLType = "timestamptz", errSQLTableOid = Just (Oid 126120), errSQLField = "activated_at", errHaskellType = "Text", errMessage = "types incompatible"}

    The activated_at field is set on the admin model and the error occurs when I call CreateSession. Locally there are no errors. The error doesn't occur for regular users who also have activated_at with the same type.

    8 replies
    Sascha Gresk
    Hi - in blog/Application/Helper/View.hs I found „Here you can add functions which are available in all your views“ so I defined a function four = 4 which I want to use it in Web/View/Posts/Edit.hs
    4 replies
    all I would get is "Variable not in scope: four“ (I defined eight = four + four)
    Hello, I have a list of Id's that I want to convert to a List of uuid's, i'm not sure how I can do that. Need a function like userIdsToUUIDs :: [Id user] -> [UUID] or userIdsToUUIDs :: [ID' "users"] -> [UUID]
    Any ideas?
    7 replies
    Hello, I'm trying to setup the environment for contributing locally and I get stuck at the point where it says run :l Main in a nix shell. I get the output Web/Types.hs:5:1: error: Could not find moduleGenerated.Types'`. This is on a fresh new ihp-new project. I cloned my up-to-date fork of IHP into the IHP folder, followed all the steps in the guide. Not sure what else I can do to get it working
    33 replies