isValid "" == False isValid "\0" == False Posix: isValid "/random_ path:*" == True Posix: isValid x == not (null x) Windows: isValid "c:\\test" == True Windows: isValid "c:\\test:of_test" == False Windows: isValid "test*" == False Windows: isValid "c:\\test\\nul" == False Windows: isValid "c:\\test\\prn.txt" == False Windows: isValid "c:\\nul\\file" == False Windows: isValid "\\\\" == False Windows: isValid "\\\\\\foo" == False Windows: isValid "\\\\?\\D:file" == False Windows: isValid "foo\tbar" == False Windows: isValid "nul .txt" == False Windows: isValid " nul.txt" == True
isValid (makeValid x) isValid x ==> makeValid x == x makeValid "" == "_" makeValid "file\0name" == "file_name" Windows: makeValid "c:\\already\\/valid" == "c:\\already\\/valid" Windows: makeValid "c:\\test:of_test" == "c:\\test_of_test" Windows: makeValid "test*" == "test_" Windows: makeValid "c:\\test\\nul" == "c:\\test\\nul_" Windows: makeValid "c:\\test\\prn.txt" == "c:\\test\\prn_.txt" Windows: makeValid "c:\\test/prn.txt" == "c:\\test/prn_.txt" Windows: makeValid "c:\\nul\\file" == "c:\\nul_\\file" Windows: makeValid "\\\\\\foo" == "\\\\drive" Windows: makeValid "\\\\?\\D:file" == "\\\\?\\D:\\file" Windows: makeValid "nul .txt" == "nul _.txt"
valid (fromAscList [(3,"b"), (5,"a")]) == True valid (fromAscList [(5,"a"), (3,"b")]) == False
do as pure ()with an inferred Functor constraint.
>>> void Nothing Nothing >>> void (Just 3) Just ()Replace the contents of an Either Int Int with unit, resulting in an Either Int ():
>>> void (Left 8675309) Left 8675309 >>> void (Right 8675309) Right ()Replace every element of a list with unit:
>>> void [1,2,3] [(),(),()]Replace the second element of a pair with unit:
>>> void (1,2) (1,())Discard the result of an IO action:
>>> mapM print [1,2] 1 2 [(),()] >>> void $ mapM print [1,2] 1 2