-
-
Save masaedw/818620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Time | |
import System.Locale | |
main = getClockTime >>= | |
toCalendarTime >>= | |
putStrLn . formatCalendarTime defaultTimeLocale "%c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Environment | |
main = getArgs >>= putStrLn . unwords |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Exit | |
main = exitFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Directory | |
main = getCurrentDirectory >>= putStrLn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
main = getContents >>= putStrLn . unlines . sort . lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Environment | |
main :: IO () | |
main = do | |
args <- getArgs | |
s <- getContents | |
tee args s | |
teeProc :: [String -> IO ()] -> String -> IO() | |
teeProc procs content = mapM_ feed procs | |
where | |
feed proc = proc content | |
tee :: [String] -> String -> IO () | |
tee args = teeProc $ putStr : map writeFile args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Exit | |
main = exitWith ExitSuccess |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main = getContents >>= \x -> putStrLn $ unlines $ uniq $ lines x | |
uniq :: (Eq a) => [a] -> [a] | |
uniq [] = [] | |
uniq (x:[]) = [x] | |
uniq (x:xs) = if x == head xs then uniq xs else x:(uniq xs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Environment | |
main = getArgs >>= putStrLn . yes | |
yes :: [String] -> String | |
yes xs = unlines $ repeat $ unwords $ normalizeArguments xs | |
normalizeArguments :: [String] -> [String] | |
normalizeArguments [] = ["y"] | |
normalizeArguments xs = xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment