Skip to content

Instantly share code, notes, and snippets.

View patrickt's full-sized avatar
🍉

Patrick Thomson patrickt

🍉
View GitHub Profile
{-# 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
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 September 2, 2019 20:42
fish-shell snippets to convert between representations of lossless audio
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"
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
{-# 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
{-# 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
{-# 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
{-# 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
{-# LANGUAGE DeriveFunctor, ExistentialQuantification, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving,
TypeApplications, KindSignatures, ScopedTypeVariables, LambdaCase, MultiParamTypeClasses, StandaloneDeriving, TypeOperators, UndecidableInstances #-}
module Control.Effect.Await
( Await (..)
, await
, awaits
, peek
, runAwaitList
) where
{-# 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