Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Marc Scholten
    @mpscholten
    can you share the rror message?
    Philip Schönholzer
    @philschonholzer
    Hey everyone! Is it possible to call a Serversside Component with arguments? Like counter = component @Counter myArg. I would like to give it the id from the current view (in my case the currently shown co2producer). Or how would I solve that?
    Marc Scholten
    @mpscholten
    not documented yet
    but check the implementation here
    you need to call componentFromState and pass a state structure
    componentFromState Counter { value = 1337 }
    Philip Schönholzer
    @philschonholzer
    Great! I'll try that. Thanks!
    phischer
    @phischer:matrix.org
    [m]
    I can't believe what I'm seeing! It's like magic! 😊
    Marc Scholten
    @mpscholten
    haha yes :)
    Adam Brunero
    @adambrunero
    hey guys, I am really liking the IHP product but am getting stuck with a knowledge gap with front-end programming. I am proficient in Haskell, Postgres and data services/python but haven't done any front-end programming. Is there a good guide or tutorial that pairs well with IHP?
    Marc Scholten
    @mpscholten
    can you share what specific topics in the frontend space are causing troubles?
    Michael Fliegner
    @Kaeptenblaubaer
    Hi! How to send a POSTrequest from a controller? I need a special controller action to determine my workflow, but cannot access the actions that need POSTs by using redirectToPath.
    6 replies
    Michael Fliegner
    @Kaeptenblaubaer
    Hi! If t' = Include "Sometable" t
    is there a constructor for t from t' and vice versa?
    3 replies
    Michael Fliegner
    @Kaeptenblaubaer
    Could I search my IHP project by signature: t -> t' or t' - >t ?
    Michael Fliegner
    @Kaeptenblaubaer
    I have an index page with a POST action for selection and clicking its Button only highlights the button's icon but triggers no action. After reloading the page it works as intended.
    module Web.View.PartnerStates.Select where
    import Web.View.Prelude
    import Web.Controller.Workflows
    
    
    data SelectView = SelectView { partnerStates :: [PartnerState], pagination :: Pagination , wfId :: Id Workflow}
    
    instance View SelectView where
        html SelectView { .. } = [hsx|
            <nav>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item active"><a href={PartnerStatesAction}>PartnerStates</a></li>
                </ol>
            </nav>
            <div class="table-responsive">
                <table class="table">
                    <thead>
                        <tr>
                            <th>PartnerState</th>
                            <th></th>
                            <th></th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>{forEach partnerStates renderPartnerState}</tbody>
                </table>
                {renderPagination pagination}
            </div>
        |]
    
    
    renderPartnerState :: PartnerState -> Html
    renderPartnerState partnerState = [hsx|
        <p><form action={ NextWorkflowAction} method="POST">
            <input type="hidden" name="Workflow" value="UpdateContractStatePartnerState" />
            <input type="text" name="partnerStateId" value={show (get #id partnerState)} />
            <button class="btn btn-primary">Select</button>
        </form></p> 
    |]
    Philip Schönholzer
    @philschonholzer

    Hey everyone! Super happy with ServerSideComponents, but either I don't really get them or something is missing. I'm needed to hand over some values from the view to the component, so as suggested I used componentFromState. The problem is that I don't really want to fill the state but give it some props (like in React). So because I fill the state from the view, and I need to have a initialState my values would always be set to the initial state after an action handler executed. To not "loose" the state value that is filled from the view, I added it to the callServerAction like this:

            <input data-gco2={tshow gCo2} class="range" type="range" min={tshow minValue} max={tshow maxValue} step={steps} value={inputValue value} oninput="callServerAction('SetCommonConsumptionValue', { newValue: parseFloat(this.value), newGCo2: parseFloat(this.dataset.gco2) })" />

    In this case I don't want gco2 to be reset so I add it to the callServerAction and after set it again in the action handler:

      action state SetCommonConsumptionValue {newValue, newGCo2} = do
        state
          |> set #value newValue
          |> set #gCo2 newGCo2
          |> pure

    So, do I use it wrong or should ServerSideComponents provide the possibility to hand over static values ("props" like in React)?

    Jon Kelly
    @jkbits1
    hi @philschonholzer First, I'm not a regular here so may be missing out on some context to your question. Also, I'm not sure I grasp all the points you make. However, I created an app using SSC recently and wanted the same React props style of initialization that you mention. I had success with the pattern shown in this digitallyinduced/ihp#936. It seems that this pattern works now, although I'm not working on that part of the app at the moment and haven't tested it so much since.
    At the time, I couldn't see this pattern mentioned in the documentation.
    Hope this is helpful. As I said, I may be missing some context so be careful I don't send you on an incorrect path for your project.
    6 replies
    Marc Scholten
    @mpscholten
    https://www.reddit.com/r/haskell/comments/prrf7a/video_of_ihp_meetup_3/ @CSchank you’re already getting comments on your talk :D
    2 replies
    Varun Rajput
    @rvarun11
    Hello! Is there a workaround for running IHP on M1 chips? When I run ./start, I get:
    error: Package ‘ghc-8.10.4in /nix/store/hc1a2akrdd0350zq7fr21ikxmc5a84ji-source/pkgs/development/compilers/ghc/8.10.4.nix:308 is not supported on ‘aarch64-darwin’, refusing to evaluate.
    Marc Scholten
    @mpscholten
    right now it’s not supported on M1 chips yet, but should be soon
    workaround: try to do it in the browser with gitpod https://ihp.digitallyinduced.com/Guide/installation.html#gitpod :)
    Varun Rajput
    @rvarun11
    Okay. Can't wait. Thank you!! :D
    Fru Fru
    @elfrucool:matrix.org
    [m]

    hi, qq, is there a way to use custom newtype records as field types on database records ?

    e.g. I want to have a newtype Money = Money { amount :: Double } type for a specific column.

    Why? to give it special format, so it can render as $100,000,000 instead of 1.0e8

    3 replies
    Philip Schönholzer
    @philschonholzer

    Hi everyone, how do I make dynamic meta data in the head of the html layout?

    <head>
    <title>Beef CO2 Footprint</title>
    <meta property="og:title" content="Beef CO2 Footprint" />
    <meta property="og:type" content="data" />
    <meta property="og:description" content="The CO2 Footprint of beef is about 67kg CO2 per 1kg of beef." />
    <meta property="og:url" content="https://domain.com/beef/" />
    <meta property="og:image" content="https://domain.com/beef/image.jpg" />
    </head>

    The title I got working with setTitle, but what about the rest?

    20 replies
    Christopher William Schankula
    @CSchank
    Is there a way to change the style / class of a modal using the IHP helper function?
    In particular, we want to make it wider (e.g. large bootstrap modals)?
    Marc Scholten
    @mpscholten
    not possible right now
    you could copy the implementation of renderModal https://github.com/digitallyinduced/ihp/blob/master/IHP/Modal/ViewFunctions.hs#L14 into your project and then make changes there
    Varun Rajput
    @rvarun11

    Hello everone!
    So, I have the following schema:

    Table: Item
    Columns: ItemID, Name
    
    Table: Tag 
    Columns: TagID, Name
    
    Table: ItemTag
    Columns: ItemTagID, ItemID, TagID

    For the Index view of Items, I want to render each Item with its respective Tags.
    Does IHP have an inbuilt fn (similar to collectionFetchRelated) which I can use here?

    2 replies
    Marc Scholten
    @mpscholten
    FYI: The new documentation search just went live :) finally we have a nice search that is working well
    18 replies
    Christopher William Schankula
    @CSchank
    Is there a good, generalized way to keep a database of all actions users do for analytics purposes?
    Christopher William Schankula
    @CSchank
    libpq: failed (could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "<path>/.s.PGSQL.5432"? ) - This was from using ./start. How come the database didn't start?
    Marc Scholten
    @mpscholten
    can you run DEBUG=1 ./start?
    it should say something in the logs
    ah wait, that depenends on the version. if you’re on v0.14 it might only show it in http://localhost:8001/PostgresLogs
    Klobbinger
    @Klobbinger
    Hey guys, is anyone here familiar with Cardano? Would ihp be a good natural choice for websites that interact with smart contracts on cardano since they are also written in haskell? Right now one of the challenges is how to run the off-vhain haskell code in the browser on the client's machine in an efficient way. Mind you, I'm not a real developer so the question might be stupid ;)
    1 reply
    Varun Rajput
    @rvarun11

    Hello everyone! So I'm switching from Bootstrap modals to IHP Modals in my codebase and I have this query:

    I've a few modals which are being called from different views and based on where they are being called from, I want to set jumpToAction and modalCloseUrl dynamically so that the backdrop will have that respective view. What's the best possible way to achieve this? ​

    The only approach I can think of is passing a variable in the action itself and use that accordingly..

    4 replies
    Marc Scholten
    @mpscholten
    psa: as we have a lot of Q/A activity here, I'd like to suggest that we can maybe move it a bit more async, like on Github discussions https://github.com/digitallyinduced/ihp/discussions or stackoverflow or the ihp forum. That way people can later find solutions on google :)
    1 reply
    Varun Rajput
    @rvarun11
    Any updates on support for M1?
    Marc Scholten
    @mpscholten
    I’ll try to bump up the nixpkgs version. Maybe you can give that a try on m1 later today?
    50 replies
    Christopher William Schankula
    @CSchank
    Hey Marc, is there a "before" and "after" for all actions? Or is this a per-controller thing only. In particular, we're interested in timing actions to monitor overall system load / health. Where might this go?
    4 replies
    Varun Rajput
    @rvarun11
    Does IHP support or plan to support Long Polling in the future?
    Marc Scholten
    @mpscholten
    not planned. What’s the use case?
    4 replies
    Marc Scholten
    @mpscholten
    IHP v0.15 is out now :tada: https://github.com/digitallyinduced/ihp/releases/tag/v0.15.0 It's a huge update with ~280 commits
    8 replies
    Marc Scholten
    @mpscholten
    Here’s a branch that should add support for apple M1 digitallyinduced/ihp#1175 @rvarun11 can you give that a try?
    9 replies
    Varun Rajput
    @rvarun11

    @mpscholten That didn't take very long. This is the error I'm getting:

    /tmp/nix-build-compiler-rt-libc-9.0.1.drv-0/compiler-rt-9.0.1.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:168:31: error: invalid application of 'sizeof' to an incomplete type 'struct stat64'
      unsigned struct_stat64_sz = sizeof(struct stat64);
                                  ^     ~~~~~~~~~~~~~~~
    /tmp/nix-build-compiler-rt-libc-9.0.1.drv-0/compiler-rt-9.0.1.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:168:45: note: forward declaration of '__sanitizer::stat64'
      unsigned struct_stat64_sz = sizeof(struct stat64);
                                                ^
    /tmp/nix-build-compiler-rt-libc-9.0.1.drv-0/compiler-rt-9.0.1.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:194:33: error: invalid application of 'sizeof' to an incomplete type 'struct statfs64'
      unsigned struct_statfs64_sz = sizeof(struct statfs64);
                                    ^     ~~~~~~~~~~~~~~~~~
    /tmp/nix-build-compiler-rt-libc-9.0.1.drv-0/compiler-rt-9.0.1.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:194:47: note: forward declaration of '__sanitizer::statfs64'
      unsigned struct_statfs64_sz = sizeof(struct statfs64);
                                                  ^
    2 errors generated.
    make[2]: *** [lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/build.make:370: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_posix.cc.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:903: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/all] Error 2
    make: *** [Makefile:136: all] Error 2
    builder for '/nix/store/3an6w2fbdkl2mgrrqbz4bci7q9wz7w5f-compiler-rt-libc-9.0.1.drv' failed with exit code 2
    cannot build derivation '/nix/store/a41aj8hj1d7sjv7i5ffyf16g5fz338d1-clang-wrapper-9.0.1.drv': 1 dependencies couldn't be built
    cannot build derivation '/nix/store/8pvbmq1c5d5q62dblz45rk5h43iz2chv-ghc-8.10.7-with-packages.drv': 1 dependencies couldn't be built
    error: build of '/nix/store/8pvbmq1c5d5q62dblz45rk5h43iz2chv-ghc-8.10.7-with-packages.drv' failed

    Should I reinstall nix?

    Marc Scholten
    @mpscholten
    same package again
    7 replies
    Varun Rajput
    @rvarun11
    Varun Rajput
    @rvarun11
    So, taking the example of the blog project in the IHP guide, let's say instead of having comments for individual posts, I want to have a live chat. What's the best way to access the post data, like postId, etc in my web socket controller without having to get that from the frontend?
    4 replies