summaryrefslogtreecommitdiff
path: root/ghc/misc/examples/posix/po005/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/misc/examples/posix/po005/Main.hs')
-rw-r--r--ghc/misc/examples/posix/po005/Main.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/ghc/misc/examples/posix/po005/Main.hs b/ghc/misc/examples/posix/po005/Main.hs
new file mode 100644
index 0000000000..8ea76255e1
--- /dev/null
+++ b/ghc/misc/examples/posix/po005/Main.hs
@@ -0,0 +1,30 @@
+import LibPosix
+
+main =
+ getEnvVar "TERM" >>= \ term ->
+ putStr term >>
+ putChar '\n' >>
+ setEnvironment [("one","1"),("two","2")] >>
+ getEnvironment >>= \ env ->
+ putText env >>
+ putChar '\n' >>
+ setEnvVar "foo" "bar" >>
+ getEnvironment >>= \ env ->
+ putText env >>
+ putChar '\n' >>
+ setEnvVar "foo" "baz" >>
+ getEnvironment >>= \ env ->
+ putText env >>
+ putChar '\n' >>
+ setEnvVar "fu" "bar" >>
+ getEnvironment >>= \ env ->
+ putText env >>
+ putChar '\n' >>
+ removeEnvVar "foo" >>
+ getEnvironment >>= \ env ->
+ putText env >>
+ putChar '\n' >>
+ setEnvironment [] >>
+ getEnvironment >>= \ env ->
+ putText env >>
+ putChar '\n'