summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoey Hess2016-06-13 16:47:17 -0400
committerJoey Hess2016-06-13 16:47:17 -0400
commitc16e2a3b6347835e1a6b5bb4031ae43d9d960746 (patch)
tree36389671c1ea3568be9f15c42801d8a13f93eb4f /doc
parenta4212ee38b552b785088e4a94cae7962ade4aec0 (diff)
comment
Diffstat (limited to 'doc')
-rw-r--r--doc/todo/integrate_shell-monad/comment_2_4e82a5994b4647b4483c92c7785ee905._comment39
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/todo/integrate_shell-monad/comment_2_4e82a5994b4647b4483c92c7785ee905._comment b/doc/todo/integrate_shell-monad/comment_2_4e82a5994b4647b4483c92c7785ee905._comment
new file mode 100644
index 00000000..0779c49f
--- /dev/null
+++ b/doc/todo/integrate_shell-monad/comment_2_4e82a5994b4647b4483c92c7785ee905._comment
@@ -0,0 +1,39 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 2"""
+ date="2016-06-13T20:23:37Z"
+ content="""
+One easy way would be something like:
+
+ shellMonadProperty :: Control.Monad.Shell.Script Result -> Property UnixLike
+
+But, I don't know if that would really be useful. The better use case for
+shell-monad seems to be where things like `userScriptProperty` take a
+`Script`, that is currently an alias for `String`. Since shell-monad can
+generate a shell script, it would be easy to write:
+
+ shellMonad :: Control.Monad.Shell.Script () -> Script
+
+Or, perhaps change userScriptProperty to accept either a stringy-Script or
+a shell monad Script, via a type class. Then it could be used like this:
+
+ userScriptProperty (User "joey") $ do
+ cmd "echo" "hello"
+ cmd "rm" "/home/joey/something"
+
+Turtle seems to not have its own monad but simply uses MonadIO. So seems
+you can use Turtle in the implementation of propellor properties the same as
+other IO actions. Which is great, it should be easy to use it if you want
+to. Something like:
+
+ import Turtle.Prelude
+
+ myProperty :: Property UnixLike
+ myProperty = property "my property using turtle" $ liftIO $ do
+ echo "hello"
+ rm "/something"
+ return NoChange
+
+But I don't think turtle can generate shell scripts like used by
+`userScriptProperty`.
+"""]]