diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-14 11:53:42 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-06-14 11:53:42 +0200 |
commit | 583f6cddc1c17bd93bb7b33cb1a5210fc330ff0f (patch) | |
tree | fbea91dff8e16fcda9df8d9632db35b5ab0877c2 /src/Sequence/Formula.hs | |
parent | d196ace4100ec5f8cfb0fad265d3baa44873fc9d (diff) | |
download | 2017-01-16_17:13:37-583f6cddc1c17bd93bb7b33cb1a5210fc330ff0f.tar 2017-01-16_17:13:37-583f6cddc1c17bd93bb7b33cb1a5210fc330ff0f.tar.gz 2017-01-16_17:13:37-583f6cddc1c17bd93bb7b33cb1a5210fc330ff0f.tar.bz2 2017-01-16_17:13:37-583f6cddc1c17bd93bb7b33cb1a5210fc330ff0f.tar.xz 2017-01-16_17:13:37-583f6cddc1c17bd93bb7b33cb1a5210fc330ff0f.zip |
cleanup
Diffstat (limited to 'src/Sequence/Formula.hs')
-rw-r--r-- | src/Sequence/Formula.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Sequence/Formula.hs b/src/Sequence/Formula.hs index be5032a..a3675c6 100644 --- a/src/Sequence/Formula.hs +++ b/src/Sequence/Formula.hs | |||
@@ -103,9 +103,10 @@ quot' = liftM2 quot | |||
103 | askQuestion :: (MonadIO m, sInput :<: lInput) => [String] -> (lInput, Maybe (Formula sInput)) -> Question sInput -> m (lInput, Maybe (Formula sInput)) | 103 | askQuestion :: (MonadIO m, sInput :<: lInput) => [String] -> (lInput, Maybe (Formula sInput)) -> Question sInput -> m (lInput, Maybe (Formula sInput)) |
104 | askQuestion promptPref input q@(Question{..}) = flip (if keepResult then set $ _1 . ctx' . answer else set _2 . Just) input . maybe (throwError q) return <$> askQ (wPromptPref $ promptPref ++ prompt) (join . fmap readMaybe) | 104 | askQuestion promptPref input q@(Question{..}) = flip (if keepResult then set $ _1 . ctx' . answer else set _2 . Just) input . maybe (throwError q) return <$> askQ (wPromptPref $ promptPref ++ prompt) (join . fmap readMaybe) |
105 | where | 105 | where |
106 | wPromptPref [] = " »" | 106 | wPromptPref [] = " " ++ sep |
107 | wPromptPref [x] = x ++ " »" | 107 | wPromptPref [x] = x ++ " " ++ sep |
108 | wPromptPref (x:xs) = x ++ " » " ++ wPromptPref xs | 108 | wPromptPref (x:xs) = x ++ " " ++ sep ++ " " ++ wPromptPref xs |
109 | sep = "»" | ||
109 | 110 | ||
110 | evalFormula :: (MonadIO m, sInput :<: lInput) => [String] -> lInput -> FormulaM sInput a -> m (lInput, a) | 111 | evalFormula :: (MonadIO m, sInput :<: lInput) => [String] -> lInput -> FormulaM sInput a -> m (lInput, a) |
111 | evalFormula promptPref input = evalFormula' [] promptPref (input, Nothing) | 112 | evalFormula promptPref input = evalFormula' [] promptPref (input, Nothing) |