Haskell on Jupyter
Recently, I have found myself leading a Haskell programming meet-up in Santa Fe, New Mexico. We meet downtown at HQ or at Desert Dogs, Mondays around 6pm. This meet-up has been a great opportunity to actually learn to program Haskell well. In an effort to archive our work as a group, I am publishing meet-up notes here.
Having a reliable test framework is an amazing thing. Here is a brief collection of notes describing some of the features and organizational structure of the
Haskell Test Framework (HTF). Most of the examples are designed for my recent work developing a ray tracing algorithm.
Here we write some methods for treating Integers as lists in the sense that
we can define notions of
take, drop, (:), (++), and unit on Integers. From these we derive further functionality, namely:
length, reverse, head, tail, and (!!). Since clearly both Integers and Lists are both instances of the same functionality, we define a class Listable handling both.
Now that there is a Listable class, we extend Listable things to be Sortable things. Put another way, given
(Ord a, Listable a) => a we define a class whose instances can be sorted via
sort and shuffled via
shuffle. The sort is a quick-sort and the shuffle is a key-shuffle.
Vector is a module designed to facilitate mathematical vector operations in the hermitian-style. For simplicity, I model only 3 dimensional vectors but allow the underlying fields to be arbitrary. Complex and Double serve as example fields throughout.
The goal here is to write an
Action class which depends on an
Abelian data type
and acts on a
Zipper type. Composition of left Abelian actions
Ab x G -> G and
evaluation are then given in the instance declaration for
Action (Zipper v).
The Swiss-McMahon tournament can be seen as a special case of the Erdős–Gallai theorem and as such, the Havel-Hakimi algorithm can be used to produce graphic tournaments. This module is designed to facilitate the production of these graphs.