Skip to content

Instantly share code, notes, and snippets.

View tonymorris's full-sized avatar

Tony Morris tonymorris

View GitHub Profile
@tonymorris
tonymorris / c172.md
Last active July 24, 2025 21:28
Cessna 172 Documentation
import Data.Bool
filter' ::
(a -> Either b c)
-> [a]
-> ([b], [c])
filter' _ [] =
([], [])
filter' f (a:as) =
let (bs, cs) = filter' f as

VH-RMV W&B

Parameters

  • Fuel: 188L (full)
  • Baggage: 45.4kg (maximum)
  • Tony: 80kg
  • Juliana: 70kg

Limits

{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
-- ghci -package lens -package tagged LeftLike.hs
import Control.Lens
import Data.Maybe
;; Pure functional I/O using clojure
;; =================================
;;
;; Defines a grammar of three operations in `defrecord Operation` using the free monad technique
;; 1. read file
;; 2. write file
;; 3. print to standard output
;;
;; Defines I/O operations by combining the Operation grammar in `defrecord IO`
;;
@tonymorris
tonymorris / ReaderWriterStateT.scala
Created April 11, 2012 16:59
Reader/Writer/State transformer in Scala
case class ReaderWriterStateT[R, W, S, F[_], A](
run: (R, S) => F[(W, A, S)]
) {
def map[B](f: A => B)(implicit F: Functor[F])
: ReaderWriterStateT[R, W, S, F, B] =
ReaderWriterStateT {
case (r, s) => F.map(run(r, s)) {
case (w, a, s) => (w, f(a), s)
}
}
@tonymorris
tonymorris / ZipAlign.hs
Last active September 25, 2024 09:03
How to generalise this function?
-- zip is to liftA2 as zipAlign is to ???
data NonEmptyList a =
NonEmptyList a [a]
deriving (Eq, Show)
data ZipAlign a b =
Align [(a, b)]
| RestA (NonEmptyList a)
| RestB (NonEmptyList b)
@tonymorris
tonymorris / gist:5367920
Created April 11, 2013 23:03
The z in scalaz
The z in scalaz means this: it was early 2008 and I was working for a Java consultancy and so of course, I used the most appropriate tool for the job: scala. But it had *terrible* libraries, so I offered to fix those while also meeting my other objectives. Turns out that the Scala guys were extremely hostile to even half-decent libraries (and still are to this day). I still struggle to wrap my head around this sometimes.
Anyway, so I thought, well fuck it, I will just keep them to myself for now. My (awesome) employer had already agreed that we'd probably open-source such a thing, but I was concerned most about my primary goal. So then it came time to "name" this library. I had named it "scalax" simply so that I did not have the inclination to think of a proper name. Then I found out that such a library was being developed and with my internal name! Whatever, I thought.
So I looked at this scalax library, hoping that I could just abandon my efforts and jump on board with everyone else -- they too had figure
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www8.garmin.com/xmlschemas/FlightPlan/v1" xmlns:fp="http://www8.garmin.com/xmlschemas/FlightPlan/v1" targetNamespace="http://www8.garmin.com/xmlschemas/FlightPlan/v1" elementFormDefault="qualified">
<xsd:annotation>
<xsd:documentation>
To transform a FlightPlan v1 XML document to GPX format a stylesheet will exist
on the Garmin website.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="flight-plan" type="FlightPlan_t">
<xsd:key name="WaypointIdKey">
@tonymorris
tonymorris / polair42.md
Last active March 26, 2024 13:54
Polair42

Brisbane Police Helicopter

What is the helicopter's registration?

VH-NVK typically on squawk code 0042

What model is the helicopter?

It is a Eurocopter BO-105.