11 import Control.Arrow.ArrowList
14 yesOrNo :: Bool -> String
19 parseYesOrNo :: ArrowChoice a => a String Bool
21 = proc str -> do case str of
22 "yes" -> returnA -< True
23 "no" -> returnA -< False
24 _ -> returnA -< error ("Expected yes or no: " ++ str)
27 maybeA :: (ArrowList a, ArrowChoice a) => a b c -> a b (Maybe c)
31 [] -> returnA -< Nothing
32 (x:_) -> returnA -< Just x
35 deleteIfEmpty :: (ArrowList a, ArrowChoice a) => a String String
37 = proc str -> do case str of
42 chomp :: String -> String
43 chomp = reverse . snd . break (/= '\n') . reverse