位: import System.Metrics.Prometheus.Metric.Histogram as H
位: h <- H.new []
位: s1 <- H.sample h
位: :print s1
s1 = HistogramSample (_t4::Buckets) 0.0 0
位: H.observe 2.2 h
位: H.observe 2.222 h
位: H.observe 1232.222 h
位: s2 <- H.sample h
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 PoolDeadlock where | |
| import Control.Concurrent (threadDelay) | |
| import Control.Concurrent.Async (replicateConcurrently_) | |
| import Data.Pool | |
| run :: Int -- ^ Pool size | |
| -> Int -- ^ f sleep | |
| -> Int -- ^ Concurrency degree | |
| -> IO () |
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 AsyncPool where | |
| import Control.Concurrent (threadDelay) | |
| import Control.Concurrent.Async (async) | |
| import Control.Concurrent.MVar (newMVar, withMVar) | |
| import Control.Concurrent.STM (atomically) | |
| import Control.Concurrent.STM.TVar (newTVarIO, readTVar, writeTVar) | |
| import Control.Monad (replicateM_, when) | |
| import Data.Pool |
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 Dhall.Repl | |
| 位: defaultRepl | |
| >>> List/head Integer [1, 2, 3] | |
| Optional Integer | |
| [1] : Optional Integer | |
| >>> List/head Integer ([] : List Integer) | |
| Optional Integer | |
| [] : Optional Integer |
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
| 位: :kind! Dh.Normalizer Int Bool | |
| Dh.Normalizer Int Bool :: * | |
| = Dh.Normalizer Int Bool | |
| 位: type family Id a where Id a = a | |
| 位: :kind! Id (Dh.Normalizer Int Bool) | |
| Id (Dh.Normalizer Int Bool) :: * | |
| = Dh.Expr Int Bool -> Maybe (Dh.Expr Int Bool) |
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
| 位: :seti -XTypeApplications | |
| 位: :seti -XDataKinds | |
| 位: import Dalek.Repl | |
| 位: import Dalek.Exts.Time.Core | |
| 位: import Dalek.Exts.Time.Parser | |
| 位: import Dalek.Exts.Time.TypeCheck | |
| 位: import Dalek.Typer | |
| 位: import Dalek.TypeCheck | |
| 位: import Dalek.Core | |
| 位: repl @(Open '[DhTime]) parser normalizer (toTyper $ sendTyper typer) |
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
| ;; I put this in my .emacs | |
| (require 'haskell-commands) | |
| (defun my-auto-format () | |
| (interactive) | |
| ;; see https://github.com/haskell/haskell-mode/blob/dd0ea640fa449d021399a17db65e4d50d3f0f2a9/haskell-commands.el#L811 | |
| (haskell-mode-buffer-apply-command "brittany")) | |
| ;; The args to call-process-region within haskell-mode-buffer-apply-command are hard-coded to nil, | |
| ;; so it looks like there's no way to use --indent=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
| { pkgs, lib, config, ... }: | |
| { | |
| networking = { | |
| firewall.allowedTCPPorts = [ | |
| 3000 # grafana | |
| 9090 # prometheus | |
| 9093 # alertmanager | |
| ]; | |
| useDHCP = true; | |
| }; |
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
| // routes1.go | |
| func Routes1(mux *http.ServeMux) { | |
| mux.Handle("/route1/a", handler1A) | |
| mux.Handle("/route1/b", handler1B) | |
| mux.Handle("/route1/c", handler1C) | |
| } | |
| // routes2.go | |
| func Routes2(mux *http.ServeMux) { | |
| mux.Handle("/route2/x", handler2X) |
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 AllowAmbiguousTypes #-} | |
| {-# LANGUAGE ConstraintKinds #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE TypeApplications #-} |