Difference between revisions of "WaSh"
Jump to navigation
Jump to search
JonFairbairn (talk | contribs) m (Random jottings on WASH) |
Andrewufrank (talk | contribs) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Tools]] |
||
+ | |||
+ | [http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/ Homepage] |
||
+ | |||
== Random Jottings on WASH == |
== Random Jottings on WASH == |
||
+ | |||
+ | Remember all programs must be precompiled with wash2hs before compilation with ghc (there may be some tools to automate this; where?). The executable produced by ghc can be moved to cgi-bin and accessed by the browser with http://localhost/cgi-bin/executableName. |
||
+ | |||
+ | === Hello world programme === |
||
+ | from [http://www.informatik.uni-freiburg.de/~thiemann/WASH/user-manual.pdf draft user manual], tweaked to work with [http://www.informatik.uni-freiburg.de/~thiemann/WASH/WashNGo-2.10.tgz version 2.10 of 20061206] |
||
+ | |||
+ | <haskell> |
||
+ | module Main where |
||
+ | import WASH.CGI.CGI hiding (div, head, map, span) |
||
+ | main = |
||
+ | run mainCGI |
||
+ | |||
+ | mainCGI = |
||
+ | ask <html> |
||
+ | <head><title>Hello World</title></head> |
||
+ | <body> |
||
+ | <h1>Hello World</h1> |
||
+ | </body> |
||
+ | </html> |
||
+ | |||
+ | </haskell> |
||
+ | |||
+ | Compile with <code>ghc -pgmF wash2hs -package WashNGo --make Main</code>. |
||
+ | |||
+ | |||
=== SELinux === |
=== SELinux === |
||
To run ghc-compiled WASH CGI on Fedora (Core 6) you need to build an SELinux policy that allows CGI scripts to execute memory (because ghc runtime system execs mem). |
To run ghc-compiled WASH CGI on Fedora (Core 6) you need to build an SELinux policy that allows CGI scripts to execute memory (because ghc runtime system execs mem). |
Latest revision as of 11:25, 6 August 2010
Random Jottings on WASH
Remember all programs must be precompiled with wash2hs before compilation with ghc (there may be some tools to automate this; where?). The executable produced by ghc can be moved to cgi-bin and accessed by the browser with http://localhost/cgi-bin/executableName.
Hello world programme
from draft user manual, tweaked to work with version 2.10 of 20061206
module Main where
import WASH.CGI.CGI hiding (div, head, map, span)
main =
run mainCGI
mainCGI =
ask <html>
<head><title>Hello World</title></head>
<body>
<h1>Hello World</h1>
</body>
</html>
Compile with ghc -pgmF wash2hs -package WashNGo --make Main
.
SELinux
To run ghc-compiled WASH CGI on Fedora (Core 6) you need to build an SELinux policy that allows CGI scripts to execute memory (because ghc runtime system execs mem).
cat <<EOF > local.te module local 1.0; require { class process execmem; type httpd_sys_script_t; role system_r; }; allow httpd_sys_script_t self:process execmem; EOF checkmodule -M -m -o local.mod local.te semodule_package -o local.pp -m local.mod su -c 'semodule -i local.pp'