summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Tonkadur/Compute.elm')
-rw-r--r--src/Tonkadur/Compute.elm11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Tonkadur/Compute.elm b/src/Tonkadur/Compute.elm
index 149f37d..a75ef7c 100644
--- a/src/Tonkadur/Compute.elm
+++ b/src/Tonkadur/Compute.elm
@@ -108,6 +108,7 @@ cast state from to param =
)
"float" -> (Tonkadur.Types.FloatValue (toFloat int))
+ "bool" -> (Tonkadur.Types.BoolValue (not (int == 0)))
"int" -> (Tonkadur.Types.IntValue int)
_ -> (unsupported_cast from to)
@@ -130,6 +131,11 @@ cast state from to param =
Nothing -> (unsupported_cast from to)
(Just result) -> (Tonkadur.Types.IntValue result)
+ "bool" ->
+ (Tonkadur.Types.BoolValue
+ ((String.toLower (String.trim as_string)) == "true")
+ )
+
"text" -> (Tonkadur.Types.TextValue text_v)
_ -> (unsupported_cast from to)
@@ -146,6 +152,11 @@ cast state from to param =
Nothing -> (unsupported_cast from to)
(Just result) -> (Tonkadur.Types.IntValue result)
+ "bool" ->
+ (Tonkadur.Types.BoolValue
+ ((String.toLower (String.trim string)) == "true")
+ )
+
"text" ->
(Tonkadur.Types.TextValue (Tonkadur.Types.StringText string))