diff options
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) |