Check that file exists: Difference between revisions
Content added Content deleted
m (→{{header|Haskell}}: Specified imports, applied hlint, hindent) |
|||
Line 1,007: | Line 1,007: | ||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
<lang haskell>import System. |
<lang haskell>import System.Directory (doesFileExist, doesDirectoryExist) |
||
import System.Directory |
|||
check :: (FilePath -> IO Bool) -> FilePath -> IO () |
check :: (FilePath -> IO Bool) -> FilePath -> IO () |
||
check p s = do |
check p s = do |
||
result <- p s |
result <- p s |
||
putStrLn $ |
|||
⚫ | |||
s ++ |
|||
if result |
|||
then " does exist" |
|||
⚫ | |||
main :: IO () |
|||
main = do |
main = do |
||
check doesFileExist "input.txt" |
check doesFileExist "input.txt" |