Questions tagged [happstack]

Happstack is a fast and flexible Haskell web framework.

Happstack is a fast and flexible Haskell web framework.

111 questions
1
vote
1 answer

Happstack - hello world server

main = simpleHTTP nullConf $ ok "Hello, World!" i am a newbie trying out haskell with happstack-server. In this hello world program, i got these doubts: 1) Server's default configuration, nullConf, where is it defined? at least it is not there in…
user2879704
1
vote
0 answers

Happstack dependency failure on Mac OS X 10.10 Yosemite

I am trying to install Happstack using the following command: cabal install happstack Specifications: Mac OS X 10.10 (Yosemite) GHC 7.8.3 cabal 1.20.0.2 Error Messages: ld: library not found for -lHSstm-2.4.3-ghc7.8.3 clang: error: linker…
rny
  • 154
  • 1
  • 8
1
vote
1 answer

Happstack handling

I'm parsing a form in happstack but I don't know of a more concise way to gather the form variables on the server. Does anyone know if there are any tricks to reduce the amount of code needed here? formHandler = do method POST delA1 …
aqui8
  • 511
  • 3
  • 11
1
vote
2 answers

How do I solve "HTTP request failed with: when is not a field" runtime errors in digestive-functors code?

I have a simple and incomplete Happstack application, that consists of a digestive-functors form defined as follows: setRecFormSpec :: Monad m => Form Text m Reminder setRecFormSpec = Reminder <$> "progname" .: string Nothing <*> "channel"…
1
vote
2 answers

Why can't a monad be decomposed?

I don't understand why I can't decompose a (let's say IO) monad. Like IO a -> a? My question originated when using happstack and wanting to get the Text out of ServerPart (Maybe Text) which is returned by (optional $ lookText "domain"). Then I…
Anton
  • 2,282
  • 26
  • 43
1
vote
1 answer

When creating a form with the Reform library, how do I put all the errors in a single list?

I'm following the tutorial for the reform library. I currently have a form with two required fields and its set up so the error message for each field shows up right next to it. postForm :: MyForm MyRequest postForm = MyRequest <$> name <*> msg…
hugomg
  • 68,213
  • 24
  • 160
  • 246
1
vote
1 answer

Happstack: web routes and form data

OK, so yesterday I tried to actually use Happstack for real. OK, so my actual question. I've got this so far: data LambdaURL = URL_CSS | URL_Input | URL_Output instance PathInfo LambdaURL where toPathSegments url = case url of …
MathematicalOrchid
  • 61,854
  • 19
  • 123
  • 220
1
vote
1 answer

Happstack get new StdGen for each request?

I have a simple little Happstack application that shows a form with an email field and a random question field to help combat spam. To get a random number I use getStdGen in my main function and pass it along to my function which creates the html.…
rzetterberg
  • 10,146
  • 4
  • 44
  • 54
1
vote
2 answers

Haskell and webframeworks

I started developing an application (some boring accounting software for inhouse use) and decided to make it web-based as this would solve a couple of problems in one go. Now with a couple of webframeworks for Haskell to choose from (happstack,…
Guenni
  • 449
  • 2
  • 8
1
vote
2 answers

Why is Happstack (toResponse) using text/plain per default?

I'm using HStringTemplate to render a very simple template using a data structure to fill in the "holes". The result of the template rendering is just a String I fed toResponse with. Even though this rendered template is valid html happstack uses…
rzetterberg
  • 10,146
  • 4
  • 44
  • 54
1
vote
1 answer

Can't install happstack-hsp

I'm using Windows 7 with cygwin too. I'd installed happstack-hsp fine with the Haskell Platform from February. I just installed the Haskell Platform from April. I tried installing happstack-hsp package, through cabal and get the following…
mercifulhop
  • 271
  • 3
  • 11
1
vote
1 answer

Get Request from happstack-lite API

How would I go about getting the Request data from the happstack-lite API? I'm trying to get the client's IP address. From what I can tell it's in Request::rqPeer, and I get confused trying to dive into the monadic-layers of the happstack API.
David
  • 2,533
  • 2
  • 18
  • 16
1
vote
1 answer

Is there a way to make Happstack recompile and auto-reload?

Currently, when building with happstack, I have to recompile my project, relaunch my .exe binary (in windows) every time I make a change to my template or source code. Is there some tools that can automate this, like what Yesod or Snap has? P.S.:…
Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272
1
vote
1 answer

Deriving PathInfo class in web routes?

I am reading the web-routes tutorial in Happstack, and I have no idea what this is doing: $(derivePathInfo ''Sitemap) class PathInfo a where toPathSegments :: a -> [String] fromPathSegments :: URLParser a The doc simply says: we use…
Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272
0
votes
2 answers

Happstack jQuery and plain text file content

I'm trying on a Happstack-build website to read out "user submitted" plain text files. The main functionallity should be to get the file content, for further usage a server side storage of the file isn't needed. What would be the way to realize…
beyeran
  • 885
  • 1
  • 8
  • 26