Skip to content

Instantly share code, notes, and snippets.

View BlastWind's full-sized avatar
👊

Andrew Chen BlastWind

👊
View GitHub Profile
@snoyberg
snoyberg / doesnt-stall.hs
Created June 21, 2018 13:58
Ensure that a conduit produces output every X microseconds
#!/usr/bin/env stack
-- stack --resolver lts-11.10 script
{-# LANGUAGE NoImplicitPrelude #-}
import RIO
import Conduit
import Control.Concurrent.STM.TBMQueue
doesn'tStall
:: MonadUnliftIO m
=> Int -- ^ number of microseconds
@VictorTaelin
VictorTaelin / implementing_fft.md
Last active July 20, 2024 08:14
Implementing complex numbers and FFT with just datatypes (no floats)

Implementing complex numbers and FFT with just datatypes (no floats)

In this article, I'll explain why implementing numbers with just algebraic datatypes is desirable. I'll then talk about common implementations of FFT (Fast Fourier Transform) and why they hide inherent inefficiencies. I'll then show how to implement integers and complex numbers with just algebraic datatypes, in a way that is extremely simple and elegant. I'll conclude by deriving a pure functional implementation of complex FFT with just datatypes, no floats.