This file contains hidden or 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.IO() | |
main :: IO () | |
main = do | |
contents <- readFile "baabaa.txt" | |
putStrLn contents |
This file contains hidden or 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
+ 95e725b... 06/07/15 04:08 public | |
d9c1b80... 05/27/15 23:45 public | |
36715d7... 05/27/15 11:44 public | |
a7fdff4... 03/25/15 21:09 public | |
494de2c... 03/25/15 20:39 public | |
0f26843... 03/25/15 20:38 public | |
f7844fc... 03/12/15 04:46 public haskell parser combinator | |
082478c... 03/07/15 17:17 public haskell StrConverter | |
a3598c7... 03/07/15 01:46 public haskell making monad | |
e7e1b18... 03/06/15 18:28 public haskell monad porland |
This file contains hidden or 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 :: IO () | |
main = interact respondPalidromes | |
respondPalidromes :: String -> String | |
respondPalidromes = unlines . map (\ xs -> if isPal xs then "palidrome" else "not a palidrome") . lines | |
isPal :: String -> Bool | |
isPal xs = xs == reverse xs |
This file contains hidden or 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 :: IO () | |
main = interact shortLinesOnly | |
shortLinesOnly :: String -> String | |
shortLinesOnly = unlines . filter (\ s -> length s < 10) . lines |
This file contains hidden or 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 :: IO () | |
main = do | |
contents <- getContents | |
putStr $ shortLinesOnly contents | |
shortLinesOnly :: String -> String | |
shortLinesOnly = unlines . filter (\ line -> length line < 10) . lines | |
-- lines :: String -> [String] | |
-- lines "aaa\nbbb\nccc" => ["aaa","bbb","ccc"] |
This file contains hidden or 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 Control.Monad | |
import Data.Char | |
main :: IO () | |
main = forever $ do | |
l <- getContents | |
putStrLn $ map toUpper l |
This file contains hidden or 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 Control.Monad | |
import Data.Char | |
main :: IO () | |
-- putStr | |
-- main = do | |
-- putStr "Hey, " | |
-- putStr "I'm " | |
-- putStr "Andy!" | |
-- putChar |
This file contains hidden or 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 Control.Monad | |
import Data.Char | |
main :: IO () | |
-- putStr | |
-- main = do | |
-- putStr "Hey, " | |
-- putStr "I'm " | |
-- putStr "Andy!" | |
-- putChar |
This file contains hidden or 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 :: IO () | |
main = do | |
a <- return "hell" | |
b <- return "yeah!" | |
putStrLn $ a ++ " " ++ b | |
-- main = do | |
-- let a = "hell" | |
-- b = "yeah" | |
-- putStrLn $ a ++ " " ++ b |
This file contains hidden or 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 :: IO () | |
main = do | |
return () | |
return "HAHAHA" | |
line <- getLine | |
return "BLAH BLAH " | |
return 4 | |
putStrLn line |