Questions tagged [yesod]
Yesod is a Haskell web framework for productive development of type-safe, RESTful, high performance web applications.
1,334
questions
1
vote
0
answers
20
views
Haskell - Yesod - print route with placeholder
In my Yesod app I have a route defined as
/bookings/#BookingId/review-data BookingReviewDataR GET
I need to pass the route to the frontend of the application in such a way that the frontend could ...
0
votes
1
answer
35
views
Configure/disable request logging in yesod
Using yesod 1.6.2.1, when creating a new application (regardless of whether using the scaffolding or using the builtin warp port foundation), you get request logs like this:
127.0.0.1 - - [18/Aug/2023:...
0
votes
0
answers
17
views
serve static files in Yesod
I'm using Yesod scaffold to build a website, and hope to serve static files from a separate domain.
I followed the instruction here to add the following code in the instance of Yesod App
...
1
vote
0
answers
23
views
Cross-Compile Yesod app for aarch64 system on x86_64
as can be inferred from the title my goal is to deploy my Yesod app to an aarch64 Ubuntu server (using Keter). For this I would like to do compilation on my x86_64 debian machine, where I also develop ...
2
votes
2
answers
77
views
Yesod scaffold returns error "The application isn’t built"
I am trying to learn Yesod and I started to have a look at https://www.yesodweb.com/book.
Before reading the book, I executed on my WSL2 Ubuntu 20.04 LTS the instructions provided at https://www....
0
votes
1
answer
41
views
Yesod Esqueleto: could not load module; member of hidden package ‘esqueleto-3.5.8.1’
Been playing around with Yesod for a few weeks. Installed stack on freebsd. Got a templated postgresql site working. Now trying to test out Esqueleto for a join query.
Installed esqueleto as so:
...
1
vote
0
answers
32
views
How to get inetd and warp to work together
I am trying to get inetd to work with warp.
Currently, I have
main = do
s <- mySocket 0
s' <- getSocketName s'
runSettingsConnection settings ((, s') <$> socketConnection settings s) ...
0
votes
1
answer
54
views
Haskell Yesod: Sending a Post Request On Image Click
I am writing a simple website in Haskell with Yesod. I have the following hamlet
<ul id="gallery">
$forall file <- listOfFiles
<form action=@{...
2
votes
1
answer
101
views
YesodAuth Google OAuth2 timing out
I'm trying to set up Authentication and Authorization for my Yesod website according to the book.
However, once I set up my Google OAuth2, I get a timeout:
HttpExceptionRequest Request {
host ...
1
vote
1
answer
133
views
How to encode VALUES constant table expression in esqueleto?
In a Yesod application using the Esqueleto EDSL, I desire to perform an anti-join with a table living in Haskell.
In pure PostgreSQL, the query would look like this:
CREATE TEMPORARY TABLE ...
0
votes
0
answers
85
views
How to write yesod handler funtions for the funtions written using Persistent Library?
I have been working on Persistent library and yesod to get familiar with databases and apis.I have made two data that contains Users and their User Links and wrote two functions.
1 . AddUsers -> If ...
0
votes
0
answers
78
views
Parse parameterized typed json request in Yesod
I'm having a request data
data Query = Query {
queryType :: String
}
$(deriveJSON defaultOptions ''Query)
a handler:
postRunQuery :: Handler Value
postRunQuery = do
runReq <- ...
0
votes
0
answers
34
views
Can't build a simple Yesod project using stack, getting an error with language-javascript-0.7.1.0 package [duplicate]
I am trying to build a simple Yesod project, but after stack build command I get the next error
#24 532.1 -- While building package language-javascript-0.7.1.0 (scroll up to its section to see the ...
1
vote
0
answers
40
views
Does yesod-bin compile under GHC 9.2.4?
i have a small yesod website that compiled under ghc 8.?
I'm trying to work with ghc 9.2.4. Depending on what I try, i either die from conflicting versions when I try to build
stack build yesod-bin
...
2
votes
1
answer
158
views
Evaluation of template haskell in Yesod
While going through the examples of the Yesod Book, I'm running into an issue with the following snippet:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ...
0
votes
1
answer
184
views
Aeson decode rounding by scientific notion
thanks for reading this , I've been struggled for a while I'm using Aeson/TH to auto generate the fromJSON/toJSON of a ADT. I'm using Yesod to accept data from HTTP call .
import Data.Aeson hiding (...
0
votes
1
answer
190
views
Yesod is using first case as return type
thanks for your time:
The idea is that the request may include either
a apple with code ( represented in integer )
apples with codes
the handler will branch base on the input
if it is an apple then ...
1
vote
0
answers
97
views
Can one reverse-proxy a small external site as a yesod subsite
I have a yesod site serving content that includes rest WaiSubsites. all working. I have a need to serve a small REACT based site and I'd like to use the same basic infrastructure to add a simple ...
2
votes
1
answer
143
views
How to setup `cors` on Yesod without scaffold structure?
There is clear doc on enable CORS in yesod
https://github.com/yesodweb/yesod-cookbook/blob/master/cookbook/Allowing-WOFF-fonts-to-be-accessed-from-other-domains-%28CORS%29.md#using-wai-cors-package
...
1
vote
0
answers
164
views
yesod installation fails.. haskell --ghc-options " -fdiagnostics-color=always"
I am trying out yesod tutorial from
https://www.yesodweb.com/page/quickstart
On step no 3 stack install yesod-bin --install-ghc
I get an error as shown below
stack install yesod-bin --install-ghc ...
4
votes
0
answers
64
views
How to implement MySql's GROUP_CONCAT using Esqueleto in Haskell?
I need to find out how to implement MySql's Group_Concat under Esqueleto in Haskell. The esqueleto function should look like the following but this version is suitable for Sqlite. So I need a working ...
2
votes
1
answer
92
views
Applicative form in Yesod
I have defined Wff data type:
data Wff = P Text | Ng Wff | Box Wff | Cnj [Wff] | Dsj [Wff]
deriving (Eq)
instance Show Wff where
show (P name) = unpack $ name
show (Ng f) = "-"...
0
votes
1
answer
44
views
Hamlet route for OptionalSubsite
I am using an OptionalSubsite as shown here: https://gist.github.com/snoyberg/8d85d41c5b4d0da002ae
How can I create a hamlet link/route to a file that is served in this subsite?
$if ...
1
vote
1
answer
77
views
How to redirect from an Yesod subsite to master (caller) site without hardcoding master routes in subsite?
I have a simple scenario of creating a new persistent entity in an Yesod subsite. After posting and inserting a new entity, the subsite should redirect to the caller site (the master site). The master ...
4
votes
1
answer
367
views
cannot compile yesod, hGetContents invalid argument
I am trying to create a Yesod project and cannot get off the 1st step.
Below are the steps I took to initialize and build:
$ stack new someproj yesodweb/postgres
$ cd someproj
$ stack build
I have ...
0
votes
1
answer
51
views
How to properly run a MForm defined in a subsite of a scaffolded Yesod site?
I'm trying a CRUD scenario with Yesod subsites with LTS 18.21 and can't figure out how to properly run the forms defined in the subsite. The following code compiles and works as expected, but I can't ...
1
vote
1
answer
91
views
How do I pass a rendered persistent/esqueleto query to another query?
I'd like to use Persistent/Esqueleto to implement count estimates.
One approach recommended in this article is to define a function like this
CREATE FUNCTION count_estimate(query text) RETURNS integer ...
2
votes
1
answer
97
views
How would you create your own default layout in Yesod?
I'm a C# back end developer trying to learn web dev with haskell and Yesod, so please bear with me.
My question is, what is the convention regarding creating your own default layout. Should you create ...
0
votes
1
answer
74
views
Cannot represent equality constraint as a custom constraint
I have a function type declaration
f :: MonadHandler m => SqlPersistT m ()
Which I want to convert to
f :: MonadHandlerDB m => m ()
I try everything I can think of to define constraint ...
2
votes
0
answers
137
views
OpenId Auth in Yesod
I'm learning Haskell, and trying out the Yesod web framework. I'd like to set up authentication with OpenId, but I've gotten pretty confused.
There's an authOpenID authentication plugin mentioned in ...
2
votes
1
answer
81
views
Is Yesod's Handler Monad an instance of MonadBaseControl IO?
I would like to use the withResource :: MonadBaseControl IO m => Pool a -> (a -> m b) -> m b from the Data.Pool library in my handler code. I am trying to determine if Handler is an ...
2
votes
0
answers
89
views
Integrating Halogen into Yesod build process
I would like to put together a webapp using Yesod for the back end and Halogen (PureScript) for the front end. Is there a best practice for having an integrated build process for the two? In ...
1
vote
1
answer
91
views
Yesod.Auth no authentication and no authorization
I'am writing a web app for personal use with Yesod. I don't want authentication and no log in.
What is the best way to achieve this?
remove the Auth library from the application
use a default hidden ...
0
votes
1
answer
43
views
How to use Hspec/Yesod.Test with Sqlite?
I have a basic Yesod server that uses an Sqlite db, and I'm trying to add tests to it.
I'm very new to Haskell, so I'm even struggling to find the right terminology, so bare with me.
I have this code ...
1
vote
1
answer
118
views
Problem to show value out of Handler monad in Haskell and Yesod
I am a beginner in Haskell and I am still studying and I stopped at the problem that has to do with monads.
The problem is that I want to show the comment writer in the template.
I can't do that ...
1
vote
1
answer
236
views
How should I make environment variables available to my web app?
OS: Ubuntu 20.04 LTS
I am attempting to deploy a web app using Keter, the app depends upon several environment variables which I seem to be struggling to make available.
For reference I've been using ...
1
vote
0
answers
162
views
CSS no longer applying with keter and nginx reverse proxy setup
Problem: CSS was being applied to the site but after switching to reverse proxy and adding a security cert while changing nothing else, the CSS no longer loads.
Details: Initially the website was ...
2
votes
1
answer
78
views
How to disable debug SQL logs in Yesod development mode
Is it possible to disable [Debug#SQL] logs when running Yesod application in development with yesod devel?
0
votes
1
answer
154
views
Couldn't match expected type 'SomeEntity’ with actual type ‘Key SomeEntity’
Hi I am a beginner in Haskell and Yesod and I need help with this problem.
These are my entities:
Location
name Text sqltype=varchar(255)
address AddressId Maybe sqltype=varchar(255)
...
0
votes
0
answers
78
views
Takeing unique values from one column in table
I am a beginner in Hashkell and Yesod, and I am interested in how to take all the unique values
from one column in the mysql table.
A concrete example is that I have an Address entity and I want ...
1
vote
0
answers
55
views
How to make mkPersist catch a typed list?
I've made a structure that looks like this:
Provider
name String
users [Int]
deriving Show Generic
However, when migration comes in with Postgres, it automatically generates a varchar ...
0
votes
0
answers
76
views
How do make Yesod the Key record with if a custom type is being used?
The situation is the following. My type definition looks like this:
Branch
name String
category String
address Address Maybe
qualifications [Int] Maybe
deriving Show Read Generic
...
1
vote
1
answer
124
views
Where does the resourcesApp come from in Yesod?
The two functions mkYesodData and mkYesodDispatch in the Yesod framework are supposed to separate the handler definition and the dispatch process. Though by some miracle (to me), templates use this ...
3
votes
1
answer
144
views
Is it safe to run two warp servers from the same `main`?
There seem to be some "global vars" (unsafePerformIO + NOINLINE) in warps code base. Is it safe to run two instances of warp from the same main function, despite this?
0
votes
1
answer
56
views
Making custom Yesod Form: Could not deduce (Monad (FormInput m))
I am trying to make multi-file form input. I am using Handling a collection of data in a Yesod Form as a reference.
Here I am trying to make association list of field names to files.
multiFileInput :: ...
2
votes
0
answers
531
views
d3 - Using D3 v3 and D3 v4 on the same page
Following from this guide: https://chewett.co.uk/blog/2021/how-to-load-multiple-d3-versions-at-once/ , I have imported D3 v3 and D3 v4 into my project (please note as well, I am using Yesod)
<...
0
votes
1
answer
105
views
Yesod Not in scope: type constructor or class Form error
I'm just following the Yesod examples from the docs blog example advanced, but I'm getting this error when doing stack runghc main.hs:
main.hs:186:14: error:
Not in scope: type constructor or ...
1
vote
1
answer
59
views
Hamlet html not registering <head> or <title> tags correctly for my home route handler
For some reason the <head> tag for the home of my website is not being processed the way I would like. Here is the source code of my site that I get from firefox. Please note that the first head ...
1
vote
0
answers
38
views
Apply margin to inner elements in a Yesod form
I'm trying to apply margin to elements inside a renderDivs form:
<$> areq textField (FieldSettings "Name: "
Nothing
...
1
vote
1
answer
547
views
What exactly does stack runghc do?
A bit of a background that leads to the question I have.
I am learning Yesod, and I am reading the Yesod book. In the Basics section of the book, the instructions on how to get a basic Yesod ...