Skip to content

Instantly share code, notes, and snippets.

Avatar
🗣️
play stupid games / win stupid prizes

Patrick Thomson patrickt

🗣️
play stupid games / win stupid prizes
View GitHub Profile
View fused-effects-1.1-benchmarks
benchmarked Error/Either
time 24.22 μs (22.36 μs .. 26.34 μs)
0.983 R² (0.970 R² .. 0.998 R²)
mean 22.90 μs (22.65 μs .. 23.36 μs)
std dev 1.045 μs (590.7 ns .. 1.930 μs)
variance introduced by outliers: 24% (moderately inflated)
benchmarked Error/Identity/Church.ErrorC
time 9.092 ms (8.772 ms .. 9.300 ms)
0.995 R² (0.990 R² .. 0.998 R²)
View fused-effects-1.0-benchmarks
benchmarked Error/Either
time 48.08 μs (47.20 μs .. 49.37 μs)
0.994 R² (0.989 R² .. 0.999 R²)
mean 47.06 μs (46.60 μs .. 47.64 μs)
std dev 1.740 μs (1.034 μs .. 2.432 μs)
variance introduced by outliers: 18% (moderately inflated)
benchmarked Error/Identity/Either.ErrorC
time 5.277 ms (4.860 ms .. 5.552 ms)
0.980 R² (0.969 R² .. 0.988 R²)
View hack.diff
diff --git i/summoner-cli/src/Summoner/Default.hs w/summoner-cli/src/Summoner/Default.hs
index 41dfaa6..6a25abe 100644
--- i/summoner-cli/src/Summoner/Default.hs
+++ w/summoner-cli/src/Summoner/Default.hs
@@ -29,12 +29,12 @@ import Relude.Extra.Enum (prev)
import Data.Time (getCurrentTime, toGregorian, utctDay)
import NeatInterpolation (text)
-import System.Directory (getHomeDirectory)
+import System.Directory (getHomeDirectory, doesFileExist)
View cast.hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
View Some.hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
module Data.Some
( Some (..)
, Some1 (..)
, Any
View reader results.md

Benchmarking re. ask

With -O1

Before any optimizations:

benchmarked Control.Carrier.Reader/ask/10
time                 9.877 ns   (9.380 ns .. 10.43 ns)
                     0.985 R²   (0.971 R² .. 0.997 R²)
View gist:dd17339efc01bd4c85308d1a2b0e3cae
tr-sttr-0.5.0.0-2ca28879
tr-sttr-0.5.0.0-e60384cd
tr-sttr-g-0.2.0.1-8ca53757
tr-sttr-g-0.2.0.1-396cb03e
tr-sttr-g-0.2.0.1-90280971
tr-sttr-g-0.2.0.1-cb98253a
tr-sttr-jsn-0.3.0.0-5e1d169c
tr-sttr-jsn-0.3.0.0-6dddeb00
tr-sttr-jsn-0.3.0.0-cfda7faf
tr-sttr-jv-0.4.0.0-3db72760
View MWC.hs
{-# LANGUAGE GeneralizedNewtypeDeriving, MultiParamTypeClasses, ScopedTypeVariables, FlexibleInstances, UndecidableInstances, ExistentialQuantification, TypeApplications, StandaloneDeriving, DeriveFunctor, TypeOperators #-}
module Control.Effect.Random.MWC
( Random (..)
, Control.Effect.Random.MWC.uniform
, Control.Effect.Random.MWC.uniformR
, RandomC (..)
, runRandom
, Variate
, Has
View table.hs
data Separator = Dot | Quest | App
data Access t
= Access Separator (Access t) (Access t)
| Term (t Name)
| Base Name
desugar :: (Monad m, Carrier sig t, Member Core sig) => Access t -> m (t Name)
desugar t = case t of
Access Dot a b -> (Core....) <$> desugar a <*> ensureName b
@patrickt
patrickt / audio.fish
Created Sep 2, 2019
fish-shell snippets to convert between representations of lossless audio
View audio.fish
function flac_to_m4a
set flacs ./*.flac
if test -z "$flacs"
echo "No .flac files in current directory"
false
else
for flac_path in $flacs
set new_name (basename "$flac_path" .flac).m4a
ffmpeg -i "$flac_path" -c:a alac -c:v copy "$new_name"
You can’t perform that action at this time.