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 scalaz._ | |
import scalaz.Scalaz._ | |
import scala.collection.immutable._ | |
object Digits extends App { | |
def sequence[M[_]: Applicative, T[_], A](seq: T[M[A]])(implicit t: Traverse[T]): M[T[A]] = | |
t.traverse(identity[M[A]], seq); | |
def set[A](seq: Seq[A]): Set[A] = Set(seq : _*); | |
//def sorted[A](seq: Seq[A]): SortedSet[A] = SortedSet(seq : _*); |
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 Prelude as P | |
import Control.Exception | |
import Control.Monad | |
import Control.Monad.Trans (MonadIO(..)) | |
import Data.ByteString.Char8 as BS | |
import Data.Conduit | |
import Data.Conduit.Binary as B | |
import Data.Functor | |
import Data.Conduit.Network | |
import Data.Monoid |
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
diff --git a/network-conduit-tls/Data/Conduit/Network/TLS.hs b/network-conduit-tls/Data/Conduit/Network/TLS.hs | |
index 0531118..4798809 100644 | |
--- a/network-conduit-tls/Data/Conduit/Network/TLS.hs | |
+++ b/network-conduit-tls/Data/Conduit/Network/TLS.hs | |
@@ -9,6 +9,7 @@ module Data.Conduit.Network.TLS | |
, tlsCertificate | |
, tlsKey | |
, tlsNeedLocalAddr | |
+ , tlsAppData | |
, runTCPServerTLS |
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
-- | Just like 'awaitForever', but adds state that is passed between | |
-- invocations of conduits. | |
awaitFold :: (Monad m) => (r -> i -> ConduitM i o m r) -> r -> Conduit i m o | |
awaitFold f = loop | |
where | |
loop r = await >>= maybe (return ()) (f r >=> mseq loop) | |
{-# INLINE awaitFold #-} | |
-- | Just like 'awaitFold', but allows premature termination of a | |
-- conduit by returning @mzero@. |
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.Arrow | |
import Control.Applicative | |
import Control.Category | |
import Prelude hiding ((.), id) | |
-- * Arrow from an applicative | |
newtype AppArrow f a b = AppArrow (f (a -> b)) | |
instance (Applicative f) => Category (AppArrow f) where |
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
module Propeller where | |
import qualified Data.Foldable as F | |
import Diagrams.Prelude | |
import Diagrams.Backend.SVG | |
import Diagrams.Backend.SVG.CmdLine | |
type Diag = Diagram SVG R2 | |
wave :: Double -> Double -> Diag |
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
Empty | |
FIFO [0] Empty 1 [] 0 | |
FIFO [0] Empty 1 [1] 1 | |
FIFO [0] (FIFO [[1,2]] Empty 1 [] 0) 3 [] 0 | |
FIFO [0] (FIFO [[1,2]] Empty 1 [] 0) 3 [3] 1 | |
FIFO [0] (FIFO [[1,2]] Empty 1 [] 0) 3 [4,3] 2 | |
FIFO [0] (FIFO [[1,2]] Empty 1 [] 0) 3 [5,4,3] 3 | |
FIFO [0] (FIFO [[1,2]] Empty 1 [[3,4,5,6]] 1) 7 [] 0 | |
FIFO [0] (FIFO [[1,2]] Empty 1 [[3,4,5,6]] 1) 7 [7] 1 | |
FIFO [0] (FIFO [[1,2]] Empty 1 [[3,4,5,6]] 1) 7 [8,7] 2 |
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
primes :: [Integer] | |
primes = 2 : filter isPrime [3,5..] | |
isPrime :: Integer -> Bool | |
isPrime n = all (\p -> n `rem` p /= 0) . takeWhile (\p -> p^2 <= n) $ primes |
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
{-# LANGUAGE TypeFamilies #-} | |
import Data.Functor | |
import Data.Functor.Compose | |
import qualified Data.Foldable as F | |
import Data.Knot | |
import qualified Data.Map as M | |
import qualified Data.Traversable as T | |
-- * Functor data types | |
-- ** Person' |