Questions about Spock, a Haskell web microframework.
Questions tagged [haskell-spock]
24 questions
0
votes
1 answer
Cannot display IO [[String]] in app created in Spock and Lucid
I have an issue with Spock, Lucid and IO in Haskell. I've got a function
f :: MySQLConn -> IO [[String]]
Output of f is result of statement "SELECT * FROM TABLE" with converted [MySQLValue] lists to [String] lists.
Then I want to use function f in…

grohub
- 3
- 2
0
votes
1 answer
Testing the state updates of a wai application
I have an application written on top of Wai, configured to have some custom state and be testable with Test.Hspec.Wai.
I can test request/response interactions, but I haven't been able to figure out how to test for state changes; specifically, if my…

Tomas Aschan
- 58,548
- 56
- 243
- 402
0
votes
1 answer
Print bytestrings on Spock Web Server
Visualize a bytestring body on a webserver run on Spock (localhost for instance)
My goal : create website and view a bytestring (converted to text)
Framework: Http Simple for performing request to restAPI
Spock for my server
I don't want…

user3680029
- 179
- 8
0
votes
1 answer
How to create "ActionCtxT" in Spock?
I want to extract a value from a json object. And I have this:
post "/test" $ do
a <- jsonBody'
let b = show (a :: Object) -- works well
myVal <- (a :: Object) .: "some_key" -- error
text "test123"
And the…

Jodimoro
- 4,355
- 3
- 11
- 18
0
votes
1 answer
Unable to fix "Ambiguous type variable" in Aeson and Spock
I have a Spock application where I have this:
post "/test" $ do
a <- jsonBody'
text "test"
It throws an exception:
• Ambiguous type variable ‘a0’ arising from a use of ‘jsonBody'’
prevents the constraint ‘(Aeson.FromJSON…

Jodimoro
- 4,355
- 3
- 11
- 18
0
votes
2 answers
Haskell Spock IO within GET Route ActionCtxT Error
I try to return a uuid within a route definition for a web app (Spock Webserver).
A route is pretty simple to define
get("PATH") $ do
text "Hello World"
Now I try to return a uuid via nextRandom from the Data.UUID.V1 module.
The function returns a…

Björn Grambow
- 368
- 1
- 14
0
votes
1 answer
how do I modify inputText to use inputCheckbox
I am trying to do something similar to this, where for an element in list of strings, I have a checkbox next to it and figure out which checkbox is checked or not. Using examples from the internet, I was able to get an example running
{-# LANGUAGE…

Hristo Asenov
- 439
- 1
- 4
- 8
0
votes
1 answer
Blaze-html type error inside forM_ block
I'm just starting Haskell web development using Spock, persistent and blaze-html.
In one of the routes I have, I want to load every row in my selected tables. I do something like this:
get ("/show/flight/" /> (var :: Var Integer)) $ \f ->…

SanShin
- 5
- 3
-1
votes
2 answers
Spock or Wai/Warp and HTTPS
I have a Spock web site which must be available via HTTPS. How can I setup it up properly for that? I think it should be the same way as for Wai/Warp, but still there's no information which is up to date.

Ramiradi
- 1