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
chunksOf :: Int -> [a] -> [[a]] | |
chunksOf _ [] = [] | |
chunksOf n l = take n l : chunksOf n (drop n l) | |
type Pixel = [Int] | |
serialize :: NP.PPM -> String | |
serialize (NP.PPM (NP.PPMHeader t w h) img) | |
= unlines ( [show (maximum rgbList) | |
, show h |
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
manyN :: Int -> f a -> f [a] | |
manyN n v = many_v n | |
where | |
many_v 0 = pure [] | |
many_v n = some_v (n - 1) <|> pure [] | |
some_v 0 = pure [] | |
some_v n = liftA2 (:) v (many_v (n - 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
import Control.Arrow ((&&&)) | |
import Control.Monad.Trans.State.Strict | |
import Control.Monad | |
import Data.Foldable | |
import Data.Maybe | |
import qualified Data.Set as S | |
import Data.List | |
data Op = Op !Dir !Int |
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
λ foobar master ✗ docker build . | |
Sending build context to Docker daemon 60.93kB | |
Step 1/8 : FROM haskell:8.4 | |
---> b3e06e1d3bb7 | |
Step 2/8 : USER root | |
---> Using cache | |
---> b21f896888c0 | |
Step 3/8 : ADD . /app | |
---> 1a026c288c89 | |
Step 4/8 : WORKDIR /app |
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 DeriveDataTypeable, FlexibleContexts, MultiParamTypeClasses, NamedFieldPuns, | |
NoImplicitPrelude, OverloadedStrings, RankNTypes, ScopedTypeVariables, TupleSections, | |
ConstraintKinds, TemplateHaskell, StandaloneDeriving #-} | |
{-# OPTIONS_GHC -funbox-strict-fields -Wall -Werror #-} | |
-- dependencies: hedis retry safe data-default uuid monad-logger basic-prelude lifted-base either | |
-- | Wrapper for hedis to support redis-sentinel. It is | |
-- built-atop of, and re-exports most of, the "Database.Redis" module. | |
-- |
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
class TBQueue | |
def initialize size | |
tvar = Concurrent::TVar | |
@read = tvar.new [] | |
@write = tvar.new [] | |
@rsize = tvar.new 0 | |
@wsize = tvar.new size | |
end |
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
| IdleTimeout Word32 | |
| TerminationAction TerminationAction | |
| CalledStationId ByteString | |
| CallingStationId ByteString | |
| IdleTimeout Word32 | |
| TerminationAction TerminationAction | |
| CalledStationId ByteString | |
| CallingStationId ByteString |
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
catchesHandler :: [Handler a] -> SomeException -> IO a | |
catchesHandler handlers e = foldr tryHandler (throw e) handlers | |
where tryHandler (Handler handler) res | |
= case fromException e of | |
Just e' -> handler e' | |
Nothing -> res |
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 A where | |
class T a where | |
t :: a -> Bool |
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
Const = Struct.new(:value) do | |
def fmap(*args) | |
-> (func) { self }.curry[*args] | |
end | |
def self.make(*args) | |
-> (o) { new(o) }.curry[*args] | |
end | |
end |
NewerOlder