Skip to content

Instantly share code, notes, and snippets.

Victor Nawothnig dminuoso

Block or report user

Report or block dminuoso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist.hs
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))
View 03.hs
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
View gist:ffadea142d47d8ffa6bf092aed4907cf
λ 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
@dminuoso
dminuoso / Sentinel.hs
Created Jul 20, 2018 — forked from borsboom/Sentinel.hs
hedis wrapper for Redis Sentinel support
View Sentinel.hs
{-# 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.
--
View tbqueue.rb
class TBQueue
def initialize size
tvar = Concurrent::TVar
@read = tvar.new []
@write = tvar.new []
@rsize = tvar.new 0
@wsize = tvar.new size
end
View gist:f3e0f276935e0eef31fcee67d5a0a637
| IdleTimeout Word32
| TerminationAction TerminationAction
| CalledStationId ByteString
| CallingStationId ByteString
| IdleTimeout Word32
| TerminationAction TerminationAction
| CalledStationId ByteString
| CallingStationId ByteString
View f.hs
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
View A.hs
module A where
class T a where
t :: a -> Bool
View const.rb
Const = Struct.new(:value) do
def fmap(*args)
-> (func) { self }.curry[*args]
end
def self.make(*args)
-> (o) { new(o) }.curry[*args]
end
end
View graham.hs
module Graham where
import Data.List (sortBy)
import Data.Ord (comparing)
import Data.Monoid
data Direction = Left'
| Right'
| Straight'
deriving (Show)
You can’t perform that action at this time.