Donnacha Oisín Kidney's Blog · doisinkidney.com · 2moHyperfunctionsPosted on March 14, 2021 Tags: Haskell Check out this type: newtype a -&> b = Hyp { invoke :: (b -&> a) -> b } This a hyperfunction (Launchbury, Krstic, and Sauerwein 2013 ; 2000 ; 2000 ) , and I think it’s one of the weirdest and most interesting newtypes you can write

Donnacha Oisín Kidney's Blog · doisinkidney.com · 4moMaster's ThesisPosted on January 4, 2021 Tags: Agda The final version of my master’s thesis got approved recently so I thought I’d post it here for people who might be interested. Here’s the pdf . And all of the theorems in the thesis have been formalised in Agda. The code is

Donnacha Oisín Kidney's Blog · doisinkidney.com · 4moTrees indexed by a Cayley MonoidPosted on December 27, 2020 Tags: Haskell The Cayley monoid is well-known in Haskell (difference lists, for instance, are a specific instance of the Cayley monoid), because it gives us O ( 1 ) O(1) <> . What’s less well known is that it’s also important in dependently

Donnacha Oisín Kidney's Blog · doisinkidney.com · 5moEnumerating TreesPosted on December 14, 2020 Tags: Agda , Haskell Consider the following puzzle: Given a list of n n labels, list all the trees with those labels in order. For instance, given the labels [1,2,3,4], the answer (for binary trees) is the following: ┌1 ┌1 ┌1

Donnacha Oisín Kidney's Blog · doisinkidney.com · 6moA Queue for Effectful Breadth-First TraversalsPosted on November 23, 2020 Part 10 of a 10-part series on Breadth-First Traversals Tags: Haskell We pick up the story again at the question of a breadth-first (Applicative) traversal of a rose tree (Gibbons 2015 ) . In the last post, I finally came up with an

Donnacha Oisín Kidney's Blog · doisinkidney.com · 6moHow to set up GitHub Actions for your Agda projectPosted on November 18, 2020 Tags: Agda Recently travis-ci.org announced that they were closing down, and moving to travis-ci.com. For people who use the service, this basically means that the free component is going away, and you’ll have to pay in the future. As a result,

Donnacha Oisín Kidney's Blog · doisinkidney.com · 7moFun with CombinatorsPosted on October 17, 2020 Tags: Combinators input[type=text] { border:0; outline:0; font-size: 11px; font-family: menlo, monospace; width: 90%; } input[type=text]:focus { outline:none!important; } input[type=text]:invalid { color: red;

Donnacha Oisín Kidney's Blog · doisinkidney.com · 9moSome More List AlgorithmsPosted on August 22, 2020 Tags: Haskell It’s been a while since I last wrote a post (I’ve been busy with my Master’s thesis, which is nearly done), so I thought I would quickly throw out some fun snippets of Haskell I had reason to write over the past couple of weeks.

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrPresentation on Purely Functional Data StructuresPosted on May 19, 2020 Tags: Haskell A week or so ago I gave a presentation on purely functional data structures as part of an interview 1 . Here are the slides: https://doisinkidney.com/pdfs/purely-functional-data-structures-slides.pdf The presentation is meant to be

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrMore Random Access ListsPosted on May 2, 2020 Part 2 of a 2-part series on Random Access Lists Tags: Haskell , Agda Imports and Pragmas {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE TypeFamilyDependencies

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrAnother Breadth-First TraversalPosted on February 20, 2020 Part 9 of a 10-part series on Breadth-First Traversals Tags: Haskell This post will be quite light on details: I’m trying to gather up all of the material in this series to be a chapter in my Master’s thesis, so I’m going to leave the heavy-duty

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrTyping TABAPosted on February 15, 2020 Tags: Haskell Just a short one again today! There’s an excellent talk by Kenneth Foner at Compose from 2016 which goes through a paper by Danvy and Goldberg ( 2005 ) called “There and Back Again” (or TABA). You should watch the talk and read

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrTerminating Tricky TraversalsPosted on January 29, 2020 Part 8 of a 10-part series on Breadth-First Traversals Tags: Agda , Haskell Imports {-# OPTIONS --cubical --sized-types #-} module Post where open import ../code/terminating-tricky-traversals/Post.Prelude Just a short one today.

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrLazy Constructive Numbers and the Stern-Brocot TreePosted on December 14, 2019 Tags: Haskell , Agda In dependently typed languages, it’s often important to figure out a good “low-level” representation for some concept. The natural numbers, for instance: data Nat = Z | S Nat For “real” applications, of course, these

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrA Small Proof that Fin is InjectivePosted on November 15, 2019 Tags: Agda Imports etc. {-# OPTIONS --safe --without-K #-} module Post where open import Data.Fin using ( Fin ; suc ; zero ; _≟_ ) open import Data.Nat using ( ℕ ; suc ; zero ; _+_ ; compare ; equal ; greater ; less

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrHow to do Binary Random-Access Lists SimplyPosted on November 2, 2019 Part 1 of a 2-part series on Random Access Lists Tags: Agda “Heterogeneous Random-Access Lists” by Wouter Swierstra ( 2019 ) describes how to write a simple binary random-access list (Okasaki 1995 ) to use as a heterogeneous tuple. If you

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrWhat is Good About Haskell?Posted on October 2, 2019 Tags: Haskell Update 5/10/2019: check the bottom of this post for some links to comments and discussion. Beginners to Haskell are often confused as to what’s so great about the language. Much of the proselytizing online focuses on pretty

Donnacha Oisín Kidney's Blog · doisinkidney.com · 1yrBachelor's ThesisPosted on July 14, 2019 Tags: Agda I recently finished my undergrad degree in UCC . I’m putting my final-year project up here for reference purposes. Here is the pdf. And here’s a bibtext entry: @thesis { kidney_automatically_2019 , address = {Cork, Ireland}, type =

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrSolving Programming Puzzles without using your BrainPosted on June 4, 2019 Tags: Python This post is a write-up of a solution to part of a programming puzzle I did yesterday. It’s a little different than the usual “solution + theory” approach, though: I’m going to talk about the actual steps you’d need to take to get to

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrDeriving a Linear-Time Applicative Traversal of a Rose TreePosted on May 28, 2019 Part 7 of a 10-part series on Breadth-First Traversals Tags: Haskell The Story so Far Currently, we have several different ways to enumerate a tree in breadth-first order. The typical solution (which is the usual recommended approach in imperative

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrImplicit Corecursive QueuesPosted on May 14, 2019 Part 6 of a 10-part series on Breadth-First Traversals Tags: Haskell Fusion I was looking again at one of my implementations of breadth-first traversals: bfe :: Tree a -> [a] bfe r = f r b [] where f ( Node x xs) fw bw = x : fw (xs : bw) b

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrConcatenative Programming; The Free Monoid of Programming LanguagesPosted on May 11, 2019 Tags: Concatenative , Haskell This post demonstrates a simple encoding of a (typed) concatenative language in Haskell. Point-free style is one of the distinctive markers of functional programming languages. Want to sum a list? That’s as easy as:

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrSome Tricks for List ManipulationPosted on May 8, 2019 Tags: Haskell This post is a collection of some of the tricks I’ve learned for manipulating lists in Haskell. Each one starts with a puzzle: you should try the puzzle yourself before seeing the solution! The Tortoise and the Hare How can you split

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrList Syntax in AgdaPosted on April 20, 2019 Tags: Agda Just some silly examples of how to get a nice list syntax with mixfix operators in Agda. Intro and Imports {-# OPTIONS --without-K --safe #-} module ListSyntax where open import Data.List as List using ( List ; _∷_ ;

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrProbability Monads in Cubical AgdaPosted on April 17, 2019 Tags: Agda , Probability Cubical Agda has just come out, and I’ve been playing around with it for a bit. There’s a bunch of info out there on the theory of cubical types, and Homotopy Type Theory more generally (cubical type theory is kind of like

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrPermutations By SortingPosted on March 24, 2019 Tags: Haskell , Agda A naive—and wrong—way to shuffle a list is to assign each element in the list a random number, and then sort it. It might not be immediately obvious why: Kiselyov ( 2002 ) has a good explanation as to the problem. One way to

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrLazy Binary NumbersPosted on March 21, 2019 Part 1 of a 1-part series on Binary Numbers Tags: Agda , Haskell Number Representations When working with numbers in Agda, we usually use the following definition: .column { float: left; width: 50%; } .row:after { content: "";

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrMore Agda TipsPosted on March 14, 2019 Part 2 of a 2-part series on Agda Tips Tags: Agda Literate Agda For including Agda code in LaTeX files, Agda’s built-in literate programming support is a great tool. It typesets code well, and ensures that it typechecks which can help avoid

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrFinger Trees in AgdaPosted on February 25, 2019 Tags: Agda This Post is Available With Clickable Code Here This whole post is written with clickable identifiers and ascii art at the above link. I also provide the normal version below in case there are any problems rendering. As I have

Donnacha Oisín Kidney's Blog · doisinkidney.com · 2yrA New Ring Solver for AgdaPosted on January 25, 2019 Tags: Agda I’m finally a the point where I feel like I can make the project I’ve been working on for the past few months public: A Ring Solver for Agda . The focus of the project is ergonomics and ease-of-use: hopefully the interface to the