1
1
mirror of https://github.com/thma/LtuPatternFactory.git synced 2024-12-03 03:55:08 +03:00

on the way

This commit is contained in:
Mahler, Thomas 2019-02-04 17:34:03 +01:00
parent 1acbfc75ff
commit 88edb716c2

View File

@ -30,15 +30,9 @@ storeAndExecute' light command = do
logEntry <- liftIO (command light)
tell [logEntry]
{--
--storeAndExecute'' :: Light -> (Light -> IO String) -> WriterT[String] IO ()
--storeAndExecute'' :: Light -> Cont (WriterT[String] IO ()) Light
--storeAndExecute'' :: MonadWriter a m => ContT () (m) String
storeAndExecute'' :: Light -> ContT (String) IO Light
storeAndExecute'' light = ContT $ \command -> do
logEntry <- liftIO ((command light) :: IO String)
tell [logEntry]
--return ""
--}
liftIO (command light)
funA :: String -> Int
funA = length
@ -60,4 +54,6 @@ commandDemo = do
storeAndExecute' lamp flipDownCommand >>
storeAndExecute' lamp flipUpCommand
putStrLn $ "switch history: " ++ show result
r <- runContT (storeAndExecute'' lamp) flipUpCommand
print r