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
-- base | |
------- | |
c :: Int | |
c = 5 | |
plusc :: Int -> Int | |
plusc x = x + c | |
main = putStrLn $ "the total is: " ++ show (plusc 1) |
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
-- base | |
------- | |
c :: Int | |
c = 5 | |
plusone :: Int -> Int | |
plusone x = x + 1 | |
main = putStrLn $ "the total is: " ++ show (plusone 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.IO | |
import Control.Monad.Reader | |
import Control.Monad.IO.Class | |
import Control.Exception.Base (evaluate) | |
data ColumnHeaders = FirstLine | None | |
withCSV :: FilePath -> (Handle -> IO r) -> IO r | |
withCSV path action = do |
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.IO | |
import Control.Monad | |
import Control.Monad.IO.Class | |
import Control.Exception.Base (evaluate) | |
import Pipes | |
import Pipes.Prelude (stdoutLn) | |
withCSV :: FilePath -> (Handle -> IO r) -> IO r | |
withCSV path action = do |
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 Control.Monad.Random.Class | |
import System.Random | |
import Data.Word | |
maxIterations :: Int | |
maxIterations = 100 | |
acceptReject :: (Random a, MonadRandom m) => (a -> Bool) -> (a -> b) -> m b | |
acceptReject = acceptReject' (Just maxIterations) |