
2 Jun
2014
2 Jun
'14
4:31 p.m.
I’m trying to create a trivial Happstack application based on the example from the “File Uploads” section of the Happstack book [1]. It should work as follows: 1. If there is no file called ‘foo’ on disk, show the upload form at any page. 2. If the file exists, show its contents at ‘localhost:8000/file’ and the upload form at any other page. The difficulty is that initially the uploaded file is placed to a temporary location, but since I want to read the file later, I have to move it somewhere. ‘UploadFile-working.hs’ uses two handlers for that, which doesn’t look right. I’d like the code to look like ‘UploadFile.hs’, but it doesn’t work properly. Could anyone explain why? [1] http://happstack.com/docs/crashcourse/index.html