Bike Math!

Note: For the sake of clarity I'll probably write things you already know. It's just as much to eliminate communication errors as it is for me to keep track of what the fuck I'm even talking about. It does not imply any kind of judgment of what I assume about you :)

Here's the math behind gears and how they are used to efficiently rotate wheels. The same principles underlie how cars work but the mechanisms are


What the fuck is a monad?

Or: functor? I 'ardly know 'er!

Monads are difficult to explain without sounding either patronizing or condescending: I would sound patronizing if I came up with some facile analogy and I would be condescending to describe it categorically.

Instead, I'll frame a problem and piece-by-piece solve the problem with what will turn out to be a monad.

# source:
sudo rm -rf /Library/Frameworks/GHC.framework
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
sudo rm -rf /Library/Haskell
rm -rf .cabal
rm -rf .ghc
rm -rf ~/Library/Haskell
View free-compiler.hs
- Example of using free constructions to build a flexible little compiler.
- The goal here is not necessarily efficiency but readability and flexibility.
- The language grammar is represented by an ADT; however, instead of
- recursively referring to itself it instead references a type variable.
- We derive instances of 'Functor' and 'Traversable' for this type.
View yet-another-conway.hs
{-# LANGUAGE DeriveFunctor #-}
import Control.Applicative
import Control.Comonad
import Control.Monad (forM_)
-- These two typeclasses probably make some people groan.
class LeftRight t where
left :: t a -> t a
View pid.lhs
PID controller in Haskell
A major project I want to embark on at some point in the future is making a
quadrotor. I've made one before but I was at the mercy of a lot of off-the-shelf
software that I'm not altogether sure was entirely correct, either.
So I want to eventually program a quadrotor (or similarly awesome robot thing)
and I would really enjoy doing it in Haskell. It has a low footprint and is
already used in other real time settings.
View imperative.lhs
How to add imperative programming to a pure functional language
Many people bemoan languages such as Haskell for not supporting imperative
programming; they decry the need for math in their computer science.
![Math? In my computer? Yeah right.](
I'm here to tell you that not only does Haskell make imperative programming a
cinch, but safe and correct as well. Follow along! This post is written in
#!/usr/bin/env perl
use v5.14;
use strict;
use warnings;
use File::KeePass;
use Text::CSV;
use Data::Dump qw(pp);
use Term::ReadPassword;
View orca.hs
This came from looking at the source for the orc package on hackage.
I wanted to know why it works, and to see if I can come up with an
alternative implementation which does cool things, and possibly provide
a mechanism for orchestrating non-linear tube computations.
-- | Pilfered from the orc package on Hackage.
-- The original is specialized to one MonadIO instance.
-- Also this looks suspiciously like a continuation monad.
View my_prelude.hs
{- * Foundational functions -}
id :: a -> a
id x = x
const :: a -> b -> a
const x y = x
fix :: (a -> a) -> a
fix f = f (fix f)