mirror of
https://github.com/composewell/streamly.git
synced 2024-09-20 07:58:27 +03:00
lint free examples
This commit is contained in:
parent
bf81f70a4e
commit
354f7615fa
@ -33,7 +33,7 @@ game = do
|
||||
|
||||
h <- get
|
||||
when (h <= 0) $ fail "You die!"
|
||||
liftIO $ putStrLn $ "Health = " ++ show h
|
||||
liftIO $ putStrLn $ "Health = " <> show h
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
|
@ -55,8 +55,7 @@ updateController :: IORef (Double, Double) -> IO ()
|
||||
updateController ref = do
|
||||
e <- pollEvent
|
||||
case e of
|
||||
MouseMotion x y _ _ -> do
|
||||
writeIORef ref (fromIntegral x, fromIntegral y)
|
||||
MouseMotion x y _ _ -> writeIORef ref (fromIntegral x, fromIntegral y)
|
||||
_ -> return ()
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
@ -67,7 +66,7 @@ updateDisplay :: IORef (Double, Double) -> IO ()
|
||||
updateDisplay cref = do
|
||||
time <- SDL.getTicks
|
||||
(x, y) <- readIORef cref
|
||||
let t = (fromIntegral time) * speed / 1000
|
||||
let t = fromIntegral time * speed / 1000
|
||||
in display (x + cos t * radius, y + sin t * radius)
|
||||
|
||||
where
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Control.Monad.IO.Class (liftIO)
|
||||
import Path.IO (listDir, getCurrentDir)
|
||||
import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
|
||||
import Streamly (runStream, aheadly)
|
||||
import Streamly (runStream, aheadly, (<>))
|
||||
|
||||
-- | List the current directory recursively using concurrent processing
|
||||
--
|
||||
@ -14,5 +14,5 @@ main = do
|
||||
runStream . aheadly $ getCurrentDir >>= readdir
|
||||
where readdir d = do
|
||||
(ds, fs) <- listDir d
|
||||
liftIO $ mapM_ putStrLn $ map show fs ++ map show ds
|
||||
liftIO $ mapM_ putStrLn $ fmap show fs <> fmap show ds
|
||||
foldMap readdir ds
|
||||
|
@ -30,11 +30,11 @@ merge a b = do
|
||||
case b1 of
|
||||
Nothing -> return x <> ma
|
||||
Just (y, mb) ->
|
||||
if (y < x)
|
||||
then (return y) <> merge (return x <> ma) mb
|
||||
else (return x) <> merge ma (return y <> mb)
|
||||
if y < x
|
||||
then return y <> merge (return x <> ma) mb
|
||||
else return x <> merge ma (return y <> mb)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
xs <- A.toList $ mergeAsync getSorted getSorted
|
||||
putStrLn $ show $ length xs
|
||||
print $ length xs
|
||||
|
@ -21,7 +21,7 @@ main = do
|
||||
|
||||
where
|
||||
get :: String -> IO ()
|
||||
get s = httpNoBody (parseRequest_ s) >> putStrLn (show s)
|
||||
get s = httpNoBody (parseRequest_ s) >> print s
|
||||
|
||||
google, bing, duckduckgo :: IO ()
|
||||
google = get "https://www.google.com/search?q=haskell"
|
||||
|
Loading…
Reference in New Issue
Block a user