summaryrefslogtreecommitdiff
path: root/src/Patat/Presentation/Interactive.hs
diff options
context:
space:
mode:
authorJasperVanDerJeugt <>2016-12-28 11:29:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2016-12-28 11:29:00 (GMT)
commitd4ae9e9a6f710b785a9783a06fa42a4e66b6e42b (patch)
treeb07608def8d437225fd399c586ada4220bb9913b /src/Patat/Presentation/Interactive.hs
parent01d0d0c2e1403303f86877415dd7a5488615ace1 (diff)
version 0.4.6.00.4.6.0
Diffstat (limited to 'src/Patat/Presentation/Interactive.hs')
-rw-r--r--src/Patat/Presentation/Interactive.hs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Patat/Presentation/Interactive.hs b/src/Patat/Presentation/Interactive.hs
index d7d7d53..830f0ff 100644
--- a/src/Patat/Presentation/Interactive.hs
+++ b/src/Patat/Presentation/Interactive.hs
@@ -27,6 +27,7 @@ data PresentationCommand
| First
| Last
| Reload
+ | UnknownCommand String
--------------------------------------------------------------------------------
@@ -48,7 +49,7 @@ readPresentationCommand = do
"0" -> return First
"G" -> return Last
"r" -> return Reload
- _ -> readPresentationCommand
+ _ -> return (UnknownCommand k)
where
readKey :: IO String
readKey = do
@@ -77,14 +78,15 @@ updatePresentation
:: PresentationCommand -> Presentation -> IO UpdatedPresentation
updatePresentation cmd presentation = case cmd of
- Exit -> return ExitedPresentation
- Forward -> return $ goToSlide $ \(s, f) -> (s, f + 1)
- Backward -> return $ goToSlide $ \(s, f) -> (s, f - 1)
- SkipForward -> return $ goToSlide $ \(s, _) -> (s + 10, 0)
- SkipBackward -> return $ goToSlide $ \(s, _) -> (s - 10, 0)
- First -> return $ goToSlide $ \_ -> (0, 0)
- Last -> return $ goToSlide $ \_ -> (numSlides presentation, 0)
- Reload -> reloadPresentation
+ Exit -> return ExitedPresentation
+ Forward -> return $ goToSlide $ \(s, f) -> (s, f + 1)
+ Backward -> return $ goToSlide $ \(s, f) -> (s, f - 1)
+ SkipForward -> return $ goToSlide $ \(s, _) -> (s + 10, 0)
+ SkipBackward -> return $ goToSlide $ \(s, _) -> (s - 10, 0)
+ First -> return $ goToSlide $ \_ -> (0, 0)
+ Last -> return $ goToSlide $ \_ -> (numSlides presentation, 0)
+ Reload -> reloadPresentation
+ UnknownCommand _ -> return (UpdatedPresentation presentation)
where
numSlides :: Presentation -> Int
numSlides pres = length (pSlides pres)