diff options
author | Camil Staps | 2016-11-29 23:45:29 +0100 |
---|---|---|
committer | Camil Staps | 2016-11-29 23:45:29 +0100 |
commit | 2f4b63dc80a953da51685a5ed584c89500ed17f1 (patch) | |
tree | be3b9261ff28d5037509c1a20bc7dad6021cd3f2 | |
parent | Update CleanReadLine (diff) |
Added show_result option
-rw-r--r-- | iclean.icl | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -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) |