Questions tagged [ihp]

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

81 questions
8
votes
1 answer

How can I pass List params in IHP forms?

I am trying to make a multiple selection part of my form in IHP. Currently trying to solve it with multiple checkboxes about like this in the View. renderIngredientSelection :: Ingredient -> Html renderIngredientSelection ingredient = [hsx| …
5
votes
0 answers

One-to-zero-or-one relationship

Introduction In order to test out IHP, I've converted part of the Contoso University tutorial for ASP.NET Core to IHP. This step in the tutorial shows a data model diagram. The part that I'll focus on in this question involves Instructor and…
dharmatech
  • 8,979
  • 8
  • 42
  • 88
5
votes
1 answer

Haskell Aeson return empty object

I'm trying to return a JSON data representation if not Nothing, and an empty JSON object if Nothing; I know that I can do: encode () -- "[]" But now I'd like to have an empty object ("{}"). I have this, which works for generating JSON base on the…
Karol Karol
  • 566
  • 3
  • 7
  • 26
5
votes
1 answer

How can I customize 404 in IHP?

I could not find an obvious way to handle general 404 pages in IHP. Is there a simple way to override the default "Not Found" route on invalid pages in FrontController or Router?
4
votes
1 answer

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 creates a temporary download link. The problem is, I…
4
votes
2 answers

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 <- query @Post |> fetch comments <- query…
Varun Rajput
  • 235
  • 1
  • 7
4
votes
1 answer

IHP Haskell field display format Double values

I have a table with a Double field, e.g. foo. When I capture numbers like 50 million (50000000) and then I want to view my data, I get: 5.0e7. When I edit the record again, I also view 5.0e7 on the text field. I can solve the "show" part using a…
Fru Fru
  • 41
  • 3
4
votes
1 answer

Getting imports right in Helper files in IHP

I am trying to centralize some of my view and controller logic into helpers in their respective helper files in Application.Helper.Controller and Application.Helper.View. I am finding that I don't have access to the packages I have access to for…
4
votes
1 answer

Commenting hsx blaze-html lines in Haskell

I'm starting to experiment with IHP's webframework. I am testing some different page layouts and I can't seem to find the right way of commenting out html within the hsx QuasiQuote (which has the blaze-html syntax) whilst experimenting with the…
Montmorency
  • 412
  • 3
  • 11
3
votes
1 answer

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 where action SendFileAction { myData } = do …
Varun Rajput
  • 235
  • 1
  • 7
3
votes
1 answer

How to work with dates in IHP ? Is there any 'default' ways?

I'm trying to learn IHP by following the guide. And what I've noticed, that there aren't any functions and other stuff to deal with dates. For example: I wanted to change a date of a post to 'NOW()' when updating it action UpdatePostAction {…
George
  • 75
  • 7
3
votes
1 answer

Factoring out controller actions

Context Here's the PostsController from the blog example in the IHP guide: instance Controller PostsController where action PostsAction = do posts <- query @Post |> orderByDesc #createdAt |> fetch render…
dharmatech
  • 8,979
  • 8
  • 42
  • 88
3
votes
2 answers

How to reuse IHP classes in a IHP script?

With IHP (the haskell web framework) I created a web application. Now I want to create a IHP Script to load some external data into my database. However I'm getting a lot of import conflicts from the Prelude, but not the types I…
Tom Hemmes
  • 2,000
  • 2
  • 17
  • 23
2
votes
1 answer

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 digitallyinduced Configured…
Chris Schankula
  • 303
  • 1
  • 6
1
2 3 4 5 6