Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jason
    @rametta
    amazing!
    Sascha Gresk
    @zmijunkie
    ah thanks - have been in the garden … the weather was amazing - will watch this !!
    Jason
    @rametta
    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
    simara
    @simara:matrix.org
    [m]
    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
    @fritzfeger

    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
    @mtirao

    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)}
    {submitButton}
    |]

    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
    @mpscholten
    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
    @Unisay
    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
    @zmijunkie
    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
    @zmijunkie
    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
    @mpscholten
    great to hear :) what did you do different?
    Sascha Gresk
    @zmijunkie
    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
    @mpscholten
    maybe you can add these changes to the docs to keep them helpful for future new ihp-ers :)
    Sascha Gresk
    @zmijunkie
    my development server only works when I am not logged in … I broke some features I had before ...
    Sascha Gresk
    @zmijunkie
    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
    @mtirao

    Hi,

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

    1 reply
    Philip Schönholzer
    @philschonholzer

    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?
    <p>Welcome!</p>

    Thanks for the great work!

    10 replies
    Marc Scholten
    @mpscholten
    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
    @mpscholten
    Was a great meetup today :) Thanks everyone for showing up!
    joshua-obritsch
    @joshua-obritsch

    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
                "staging@example.com"
            else
                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
    Diamondy4
    @Diamondy4
    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
    joshua-obritsch
    @joshua-obritsch

    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');
    joshua-obritsch
    @joshua-obritsch
    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
    @mpscholten
    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
    joshua-obritsch
    @joshua-obritsch
    Alright, I'll update to the latest commit and take a look.
    Marc Scholten
    @mpscholten
    you still need to manaully change the order then
    it will only add the sql statements in the correct order on master
    joshua-obritsch
    @joshua-obritsch
    Alright, DB Update successful. :) Thank you.
    Marc Scholten
    @mpscholten
    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
    @zmijunkie
    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"
    "/bla"
    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
    joshua-obritsch
    @joshua-obritsch

    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
    @zmijunkie
    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)
    Jason
    @rametta
    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
    Jason
    @rametta
    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