diff --git a/README.md b/README.md index c72eeab..d237066 100644 --- a/README.md +++ b/README.md @@ -327,7 +327,7 @@ import Ruapu main = do Ruapu.init Ruapu.supports "mmx" >>= putStrLn . show - Ruapu.rua >>= foldl (\m x -> m >> putStrLn x) (return ()) + Ruapu.rua >>= sequence_ . map putStrLn ``` diff --git a/haskell/Ruapu.hs b/haskell/Ruapu.hs index 075c4fc..07086cb 100644 --- a/haskell/Ruapu.hs +++ b/haskell/Ruapu.hs @@ -3,7 +3,7 @@ module Ruapu where import Foreign -import Foreign.C.String (CString, newCAString, peekCAString) +import Foreign.C.String (CString, withCAString, peekCAString) foreign import ccall "ruapu.c ruapu_init" init :: IO () @@ -15,7 +15,7 @@ foreign import ccall "ruapu.c ruapu_rua" cRua :: IO (Ptr CString) supports :: String -> IO Bool -supports xs = (newCAString xs) >>= cSupports +supports = flip withCAString cSupports rua :: IO [String] rua = cRua >>= peekArray0 nullPtr >>= mapM peekCAString