Questions tagged [ihp]

Questions related to the Haskell web framework IHP (integrated Haskell Platform). https://ihp.digitallyinduced.com/

Filter by
Sorted by
Tagged with
1 vote
1 answer
74 views

How to use forEach with multiple traversables?

I am not able to find a way where I can use forEach with multiple traversables meaning a function that is fn :: _ -> _ -> Html rather than just fn :: _ -> Html and I don't think the ...
schola's user avatar
  • 9
1 vote
1 answer
103 views

Could not deduce (IHP.RouterSupport.AutoRoute (Id' "hardwareVendors"))

It looks like I'm not passing the correct parameter to this action. I'm not sure how to debug this error though :/ Any tips on getting started? error: Web/View/HardwareVendors/Show.hs:8:33 • Could ...
Geoff Langenderfer's user avatar
-1 votes
1 answer
50 views

Couldn't match expected type ‘Text’ with actual type ‘Data.MonoTraversable.Element mono0’ The type variable ‘mono0’ is ambiguous

I'm trying to create html nodes but running into this error: Web/View/HardwareVendors/Show.hs:7:33 • Couldn't match expected type ‘Text’ with actual type ‘Data.MonoTraversable....
Geoff Langenderfer's user avatar
1 vote
1 answer
38 views

Does IHP run migrations atomically?

I can't seem to find this in the guide. Is it necessary for us to add BEGIN; and COMMIT; to our migration files or is this handled by IHP?
Chris Schankula's user avatar
4 votes
1 answer
39 views

Is there an alternative to createTemporaryDownloadUrl that doesn't require file storage on the server?

I am trying to export a particular string as a csv file and I want the user to be able to download this file. IHP has the createTemporaryDownloadUrl function that takes in a StoredFile and then ...
Piotr Wiatr's user avatar
1 vote
1 answer
108 views

Unable to install dependencies in IHP blog demo project

I'm new to IHP so I'm following the getting started guide. I'm now stuck in the last part of Section 5 (extending with markdown). When explaining how to install the required package, this are the ...
gchicote's user avatar
2 votes
1 answer
50 views

Any idea why Cachix isn't working for me on macOS?

This is using Nix 2.15.0 and IHP 1.0.1 on macOS. Despite running cachix use digitallyinduced, it still wants to build 131 packages using GHC, which takes forever! Any idea why? ✗ cachix use ...
Chris Schankula's user avatar
1 vote
1 answer
52 views

How do I pass values to a `sqlQuery "…WHERE x IN ?"` in IHP?

I've tried users :: [Users] <- sqlQuery "SELECT * FROM users u … WHERE u.id IN ?" (userIds :: [Id User]) and (Only userIds) and (In userIds) but no success. I can't find any examples in ...
unhammer's user avatar
  • 4,360
0 votes
1 answer
37 views

How do I add instances to the Web/Types section?

Currently, I am making program to help book appointments. Part of that includes making timeslots. In my program I have created the following instance for a selectField option in a form instance ...
adon's user avatar
  • 1
2 votes
2 answers
80 views

Get a record outside of an `Include'`

I have a post that has an Include' as I've fetched it with a fetchRelated, so it has this type: post :: Include' ["comments"] Post If I'd like to save it, I'd get an error post |> set #...
amitaibu's user avatar
  • 1,056
0 votes
1 answer
37 views

IHP Haskell Framework: can postgres columns of type int8range be used?

Is it possible to use columns of type int8range? The code editor cannot parse "int8range". Can a preexisisting postgres schema be used with IHP? I need those for a bitemporal model.
Michael Fliegner's user avatar
0 votes
1 answer
51 views

How to qualify name of a field when using generated types

How do you qualify the name of a field within a function like this: let sortedIssues :: [Issue] = sortOn updatedAt issues I have an issues table with an updated_at column. However, I also have ...
stephenbenedict's user avatar
1 vote
0 answers
45 views

How to write Advanced Policies for IHP DataSync?

I have the following schema: Users: id, name Group: id, room_id Rooms: id ChatMessages: id, body, user_id, room_id, created_at The Guide shows how to create a basic policy for user_id column with ...
Varun Rajput's user avatar
1 vote
2 answers
62 views

Fields of `NewView' not initialised

I'm trying to go through the ihp blog tutorial, but I'm not sure how to resolve this error. I'm new to haskell. I've tried asking chat gpt, but no luck so far. Do I need to initialize an empty comment ...
Geoff Langenderfer's user avatar
1 vote
1 answer
58 views

How to set HTTP status code manually in IHP response

Context I am using EasyCron (https://www.easycron.com) to ping an endpoint in my IHP app. If the code on my app's side fails for some reason, I would like to set the HTTP status code to 503 or similar ...
stephenbenedict's user avatar
3 votes
1 answer
49 views

IHP - How to send an attachment as a response from IHP Action?

How to send an attachment as a response from an IHP action in such a way that after the file is sent, it is deleted from the server. import System.IO (appendFile) instance Controller MyController ...
Varun Rajput's user avatar
1 vote
1 answer
64 views

how do I turn off ihp telemetry

how do I turn off ihp telemetry? A bad setting for a work laptop. I think it should be default off. I tried adding this variable to .envrc without any luck: ~/work/1031exchange.ai/blog ❯ cat .envrc ...
Geoff Langenderfer's user avatar
1 vote
1 answer
161 views

Aeson parse IHP payload to record type

What I am trying to do? I am receing a JSON payload in IHP and would like to convert to record type. What I have Record type that I've generated with the IHP generators data Resource' userId ...
hrust's user avatar
  • 734
0 votes
0 answers
118 views

IHP: How can I save multi-select html element values in database?

Let's say, I have a custom form in frontView, with "txtroles" multi-select HTML element. I submit it to my "UpdateProjectUsersAction" and would like to save it to my "...
Akash Patel's user avatar
2 votes
0 answers
130 views

IHP - What all does`ihp-app-to-docker-image` command do?

I generated a docker image for my IHP Pro app with ihp-app-to-docker-image as shown in the documentation. Is this image production ready or do we have to update Config.hs as shown under Deploying on ...
Varun Rajput's user avatar
0 votes
1 answer
109 views

IHP: Can I still use formFor if I want to include a field that's not a column of the record?

Say I've got some NewView for a record Order which is table order in the database with columns qt and item, but when users submit to create a order row I'd like to also send along some extra data to ...
unhammer's user avatar
  • 4,360
0 votes
1 answer
72 views

Can IHP be used for an app backend with JWT authentication?

Has anyone used IHP for an app backend and if so, what changes need to be made for that to be doable? Is there a jwt package or something like it that allows IHP to have JWT authentication? Does ...
Tyler Jones's user avatar
  • 1,313
1 vote
1 answer
27 views

How do you use <datalist> with IHP?

Is there some builtin method for HTML text field completion with a simple <datalist> in IHP? E.g. as in https://stackoverflow.com/a/19779010/69663
unhammer's user avatar
  • 4,360
2 votes
1 answer
49 views

IHP - How to use Select Inputs with Nullable Enums in HSX Forms?

Given an enum: CREATE TYPE CONTENT_TYPE AS ENUM ('video', 'article', 'audio'); How should I update the my HSX Form selectField to support Maybe ContentType? formFor subscription [hsx| {...
Varun Rajput's user avatar
1 vote
0 answers
29 views

The custom layout isn't loading automatically

I have created a custom layout in Layout.hs. This is applied to a reporting page that has a different styling (CSS) and JS from the rest of the application. The report page is accessed via link in the ...
patro's user avatar
  • 11
1 vote
1 answer
72 views

IHP - Unable to retrieve special characters from request body

I'm trying to send the request using ajax: const formBody = document.getElementById('body'); // my form data const XHR = new XMLHttpRequest(); const params = "body=" + formBody; ...
Varun Rajput's user avatar
1 vote
1 answer
37 views

Localizing an IHP application

Some features of the Haskell web framework IHP produce strings that are sen by the user, e.g. the error messages from validators like nonEmpty, and they are all in English. How would I use IHP to ...
Joachim Breitner's user avatar
1 vote
1 answer
115 views

IHP - How to connect IHP's Postgres instance with Moodle?

I'm trying to connect IHP's Postgres instance with Moodle. The IHP Guide uses postgresql:///app?host=YOUR_PROJECT_DIRECTORY/build/db with the development server running to connect however Moodle ...
Varun Rajput's user avatar
0 votes
2 answers
39 views

Prevent IHP RunDevServer from automatically opening a window or tab

Is there a way to start the server without it automatically opening a tab? Something similar to webpack serve --no-open
technoY2K's user avatar
  • 2,462
0 votes
1 answer
36 views

Is there a specific pattern for tracking Header Referrer Data in IHP apps?

Anyone have a recommendation/pattern for tracking HTTP: Referrer header data in an IHP app? I was thinking it might be best to add it to the beforeAction in the Static Controller for the app landing ...
Montmorency's user avatar
0 votes
1 answer
42 views

Does IHP support a Ubuntu Server for ARM?

Does IHP support a Ubuntu Server for ARM? https://ubuntu.com/download/server/arm Major Operating Systems Supported: Windows (via Linux Subsystem), macOS, NixOS, Debian, Ubuntu https://ihp....
moodtwo's user avatar
  • 11
1 vote
1 answer
79 views

build/ihp-lib/Makefile.dist: No such file or directory

$ make -B build/ihp-lib Makefile:30: build/ihp-lib/Makefile.dist: No such file or directory make: *** No rule to make target 'build/ihp-lib/Makefile.dist'. Stop. Try to run make -B build/ihp-lib to ...
moodtwo's user avatar
  • 11
1 vote
0 answers
80 views

IHP - Morphdom interfering with other JavaScript (e.g. DyGraph)

I am using IHP and IHP's use of Morphdom and / or Turbolinks seems to interfere with some other JavaScript things when the page isn't a fresh load. This includes things like Elm apps, and in this ...
Chris Schankula's user avatar
2 votes
1 answer
35 views

IHP - sorting on field in joined tables?

Is it possible to sort on a field in a joined table? For instance, if I want something like: (modules, pagination) <- query @Module |> innerJoin @User (#userId, #id) |> ...
Chris Schankula's user avatar
1 vote
1 answer
94 views

Custom route, but keep some routes as the automatic ones

I've added a few Actions on top of the CRUD ones, and I want to have custom routes to the new actions. But still, keep the CRUD actions with the same route (e.g. /ShowPost?postId=[uuid] instance ...
amitaibu's user avatar
  • 1,056
2 votes
1 answer
53 views

Is it possible to open an IHP shell?

Maybe a dumb question if there is an obvious answer, but is there a way to open up your IHP project in something like ghci to be able to, e.g., run queries from the database and such interactively ...
Chris Schankula's user avatar
1 vote
1 answer
32 views

IHP - Is there a way to set the static assets directory?

I believe by default the IHP static directory is a relative directory to pwd/static. Is there a way to set it to another, fixed directory?
Chris Schankula's user avatar
0 votes
1 answer
59 views

How would I test IHP my CanRoute instance (parse route for beautiful URLs)?

If you want beautiful URLs in an IHP app you need to write your own CanRoute instance and parse the route string. -- Web.Routes.hs module Web.Routes where import Generated.Types import IHP....
Philip Schönholzer's user avatar
2 votes
2 answers
84 views

Is possible to upload files with formForWithoutJavascript in IHP?

File uploads in IHP seems to behave quite differently in a formFor without JS compared to formForWithoutJavascript. I wanted to try to perform file uploads without JS as I figured there are parts of ...
Lars Lillo Ulvestad's user avatar
0 votes
1 answer
92 views

How to achieve a user-defined order with IHP?

I need to order pages (defined by user, drag and drop), something like ("Hello", order 1), ("Bye", order 2) And then insert, let's say ("Good", order 1), so the ...
danielsokil's user avatar
2 votes
1 answer
43 views

Issue uploading/accessing S3 uploads with IHP

I am having an issue with S3 in IHP, or the IHP plugin for it. I'm saving files to AWS storage, I get an url back to save in the database, but nothing gets saved in S3. And no error message from IHP. ...
Lars Lillo Ulvestad's user avatar
2 votes
1 answer
49 views

Highlighting active link with arbitrary number of query parameters

I'm trying to highlight a link in the main navigation bar by adding the "active" css class with ("active", isActivePath MyAction) which works but I would like it to also add the &...
sigrdrifa's user avatar
1 vote
1 answer
90 views

How to pass an action into Application.Helper.View

In Application.Helper.View I would like to create an HTML component like: button :: action -> Text -> Html button action label = [hsx|<a href={urlTo action}>{label}</a>|] which I ...
stephenbenedict's user avatar
2 votes
2 answers
60 views

IHP Script to create a new user

I’m trying out IHP for a new application, where we lock everything behind authentication and only allow existing users to sign up other new users… what is the best way to seed a user, or at least ...
Michael Gold's user avatar
1 vote
1 answer
32 views

How to handle form control for PostgreSQL’s point type in IHP?

IHP's PostgreSQL implementation supports the POINT column type, and the IHP API has functions to parse and serialize, but I how to create form fields in a New and Edit View for it?
Fritz Feger's user avatar
1 vote
1 answer
43 views

IHP - How to use multiple collectionFetchRelated?

I have the following Comments schema: Table: Comments Columns: id, post_id, body, user_id, created_at I want to fetch comments with its respective post and user. Using collectionFetchRelated for one ...
Varun Rajput's user avatar
4 votes
2 answers
81 views

IHP - Best way to combine and sort data from two tables into a single view?

I have two tables: Table: Posts Columns: id, title, body, author_id, created_at Table: Comments Columns: id, post_id, body, author_id, created_at I have the following action: action MyAction: posts ...
Varun Rajput's user avatar
0 votes
0 answers
136 views

IHP: ./start: line 29: RunDevServer: command not found

when execute the ./start of the blog example, got the following error: error: cycle detected in build of '/nix/store/mhgprkxfnmjglp547skvagf4kwikd23h-ormolu-0.1.4.1.drv' in the references of output '...
vajra's user avatar
  • 1
1 vote
1 answer
55 views

Dealing with complex query results in IHP without having to manually specify columns?

The "Dealing With Complex Query Results" section of https://ihp.digitallyinduced.com/Guide/database.html shows how you can "include extra data" when querying for a database type, ...
L42's user avatar
  • 3,092
2 votes
1 answer
44 views

IHP - How to write a custom response at the end of an action?

I have POST action that ends in a custom IO operation. The server sends a 500 Internal Server Error even if the operation was successful. I need to send a custom response to deal with this. How should ...
Varun Rajput's user avatar