aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-11-29 23:45:29 +0100
committerCamil Staps2016-11-29 23:45:29 +0100
commit2f4b63dc80a953da51685a5ed584c89500ed17f1 (patch)
treebe3b9261ff28d5037509c1a20bc7dad6021cd3f2
parentUpdate CleanReadLine (diff)
Added show_result option
-rw-r--r--iclean.icl21
1 files changed, 13 insertions, 8 deletions
diff --git a/iclean.icl b/iclean.icl
index 4c84509..48dcf35 100644
--- a/iclean.icl
+++ b/iclean.icl
@@ -62,10 +62,11 @@ help =:
instance zero Status where zero = { memory = [], settings = zero }
:: Settings
- = { show_type :: Bool
+ = { show_type :: Bool
+ , show_result :: Bool
}
-instance zero Settings where zero = { show_type = False }
+instance zero Settings where zero = { show_type = False, show_result = True }
Start :: *World -> *World
Start w
@@ -138,6 +139,8 @@ where
settings =
[ ("show_type", set_bool "Showing types" "Not showing types"
(\b s -> {s & settings.show_type = b}))
+ , ("show_result", set_bool "Showing results" "Not showing results"
+ (\b s -> {s & settings.show_result = b}))
]
lookup :: k [(k,v)] -> Maybe v | == k
@@ -171,12 +174,14 @@ writemodule stat s w
| not ok = abort ("Couldn't close " +++ temp_file +++ "\n")
| otherwise = w
where
- start
- | stat.settings.show_type
- = "toString (typeCodeOfDynamic (dynamic start)) " +++
- "+++ \" :: \" +++ foldl (+++) \"\" rslt +++ \"\\n\"\n"
- | otherwise
- = "foldl (+++) \"\" rslt +++ \"\\n\"\n"
+ start = case (stat.settings.show_type, stat.settings.show_result) of
+ (True, True) = type +++ "+++\" :: \"+++" +++ rslt +++ "+++\"\\n\"\n"
+ (True, False) = type +++ "+++\"\\n\"\n"
+ (False, True) = rslt +++ "+++\"\\n\"\n"
+ (False, False) = "()"
+ where
+ type = "toString (typeCodeOfDynamic (dynamic start))"
+ rslt = "foldl (+++) \"\" rslt"
// C functions
compile :: !String !String !*World -> *(!Int,!*World)