Personal tools

WaSh

From HaskellWiki

Revision as of 11:26, 21 March 2007 by JonFairbairn (Talk | contribs)

Jump to: navigation, search

1 Random Jottings on WASH

1.1 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>

Though I can't see how to get ghc -package WashNGo --make Main to preprocess automatically — if you put the above in Main.wash then wash2hs Main.wash, you can then ghc -package WashNGo --make Main.


1.2 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'