Skip to content

Instantly share code, notes, and snippets.

🗣
play stupid games / win stupid prizes

Patrick Thomson patrickt

🗣
play stupid games / win stupid prizes
Block or report user

Report or block patrickt

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 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"
View profiling_single_carrier.hs
Tue Apr 23 17:57 2019 Time and Allocation Profiling Report (Final)
composeconf +RTS -p -RTS
total time = 10.21 secs (10214 ticks @ 1000 us, 1 processor)
total alloc = 19,708,594,272 bytes (excludes profiling overheads)
COST CENTRE MODULE SRC %time %alloc
>>= RWS src/RWS.hs:(28,3)-(30,24) 41.0 4.3
View RWS.hs
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, TypeOperators, UndecidableInstances, DeriveFunctor, StandaloneDeriving, RankNTypes #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module RWS where
import Control.Applicative
import Control.Effect
import Control.Effect.Carrier
import Control.Effect.Reader
import Control.Effect.State.Internal
View Instances.hs
{-# LANGUAGE StandaloneDeriving, GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Control.Effect.Parallel.Instances where
import Control.Monad.Parallel
import Control.Effect.Lift
import Control.Effect.Pure
import Control.Effect.State
import Control.Effect.Trace
--import Control.Effect.NonDet
View Thread.hs
{-# LANGUAGE DeriveFunctor, ExistentialQuantification, FlexibleContexts, StandaloneDeriving, RankNTypes, TypeOperators, FlexibleInstances, TypeFamilies, UndecidableInstances, MultiParamTypeClasses, ScopedTypeVariables, GeneralizedNewtypeDeriving, LambdaCase, TypeApplications #-}
module Control.Effect.Thread where
import Control.Effect
import Control.Effect.Sum
import Control.Effect.Carrier
import Control.Effect.State
import Control.Monad.IO.Class
import Control.Monad.IO.Unlift
View Cont.hs
{-# LANGUAGE DeriveFunctor, FlexibleContexts, FlexibleInstances, KindSignatures, ExistentialQuantification, RankNTypes, StandaloneDeriving, GeneralizedNewtypeDeriving, TypeOperators, MultiParamTypeClasses, QuantifiedConstraints, UndecidableInstances #-}
module Control.Effect.Cont where
import Control.Effect.Carrier
import Control.Monad
import Control.Effect.Sum
import Data.Coerce
data Cont (ref :: * -> *) (m :: * -> *) k
View Await.hs
{-# LANGUAGE DeriveFunctor, ExistentialQuantification, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving,
TypeApplications, KindSignatures, ScopedTypeVariables, LambdaCase, MultiParamTypeClasses, StandaloneDeriving, TypeOperators, UndecidableInstances #-}
module Control.Effect.Await
( Await (..)
, await
, awaits
, peek
, runAwaitList
) where
View Control.hs
{-# LANGUAGE StandaloneDeriving, MultiParamTypeClasses, FlexibleInstances, GeneralizedNewtypeDeriving, TupleSections, TypeFamilies, UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Control.Effect.Control where
import Control.Monad
import Control.Effect
import Control.Effect.Reader
import Control.Effect.Random
import Control.Effect.Error
You can’t perform that action at this time.