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
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE Trustworthy #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE DeriveDataTypeable #-} | |
{-# LANGUAGE DefaultSignatures #-} |
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
module Main where | |
import Prelude hiding (lines) | |
import Lens.Family | |
import Pipes | |
import Pipes.Group | |
import Pipes.HTTP | |
import Pipes.Text | |
import Pipes.Text.Encoding | |
import Pipes.Text.IO (toHandle,stdout) |
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
{-#LANGUAGE BangPatterns #-} | |
import GHC.Magic | |
import Data.IORef | |
import Control.Monad | |
import Control.Monad.Trans | |
data Stream a m r = Yield a (Stream a m r) | Done r | Delay (() -> m (Stream a m r)) | |
instance Functor m => Functor (Stream a m) where | |
fmap f (Done r) = Done (f r) |
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
%!TEX TS-program = xelatex | |
\documentclass[12pt]{scrartcl} | |
% This ^^^ is a standard LaTeX document class declaration | |
% (the previous line is a pseudo-comment, declaring that we will | |
% use the special XeTeX machinery for its more extensive font list | |
% and its use of unicode.) | |
% If you made this line more akin to the one in the default | |
% latex.template file, say: | |
% \documentclass$if(fontsize)$[$fontsize$]$endif${scrartcl} |
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 Streaming | |
import qualified Streaming.Prelude as S | |
import Control.Monad | |
main = do | |
S.effects (hilo 30 ) | |
putStrLn "Right, 30 is correct!" | |
hilo :: Int -> Stream (Of Int) IO () | |
hilo n = void $ S.break (== n) | |
$ S.chain (\a -> when (a < n) $ putStrLn $ "Too small!") |
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
{-#LANGUAGE GADTs, TypeApplications, DataKinds, TypeOperators #-} | |
import Control.Monad.Freer | |
import qualified Control.Monad.Freer as F | |
import Control.Monad.Trans.Writer | |
import Control.Monad.IO.Class | |
type Loc = Int | |
type LogSource = Int | |
type LogLevel = Int | |
type LogStr = String |
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
benchmarking fold/streaming | |
time 1.493 ms (1.400 ms .. 1.591 ms) | |
0.978 R² (0.973 R² .. 0.987 R²) | |
mean 1.365 ms (1.331 ms .. 1.414 ms) | |
std dev 131.6 μs (100.7 μs .. 169.4 μs) | |
variance introduced by outliers: 69% (severely inflated) | |
benchmarking fold/conduit | |
time 3.539 ms (3.431 ms .. 3.663 ms) | |
0.991 R² (0.985 R² .. 0.995 R²) |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import System.Environment | |
import Data.Monoid | |
import Control.Monad | |
import Data.Aeson | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as T | |
import Network.HTTP.Client |
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
{-#LANGUAGE BangPatterns #-} | |
-- module Main (main) where | |
import Data.Conduit as C | |
import qualified Data.Conduit.Combinators as C | |
import Pipes as P | |
import qualified Pipes.Prelude as P | |
import qualified Streaming.Prelude as Str |
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.Concurrent (threadDelay) | |
import Control.Concurrent.Async (race) | |
import Control.Monad | |
marika = forever $ do | |
threadDelay (10^6) | |
putStrLn "Marika Boo!!!" | |
s = do | |
c <- getChar |