Programming with Categories - Lecture 8 - **Blueprints and Models**

These are my notes on the first part of Bartosz' lecture.

A very simple **blueprint** for a vertebrate animal, consists of a body connected to a head at the top and four limbs along the sides, two limbs per side. Bartosz draws this as a stick figure.

~~~
O
|
--|--
|
--|--
|
~~~

There can be many models of this blueprint category. **Human** and **Dog** are two such models. The human stick figure is the stereotype of what any kindergarten kid can do - it has the same number of lines as the blueprint (6).

~~~
O
/|\
/ \
~~~

And here's my version of the dog. See the video around 2:30 to see Bartosz' much better drawing of a dog.

~~~
O-----
/\ /\
~~~

How are these models related to each other and to the blueprint? Each is a separate category.

Below are the beginnings of my program that implements this in Haskell. I am just starting to learn Haskell so this is probably very naive.

To run it, or your own version of a Haskell implementation, you can install Haskell on your computer.

Or you can visit https://repl.it/languages/haskell, paste the following code into the editor, and click _run_.

~~~
main = do
-- specify the objects in each of the three categories
let blueprint = [0..5]
let human = ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"]
let dog = ["head", "body", "frontleftpaw", "frontrightpaw", "backleftpaw", "backrightpaw"]

-- specify the morphisms from blueprint to each of the two models, using lists of pairs
let bh = zip blueprint human
let bd = zip blueprint dog

-- print out the lists of pairs (the morphisms)
print bh
print bd
~~~

The result is:
~~~
[(0,"head"),(1,"body"),(2,"leftarm"),(3,"rightarm"),(4,"leftleg"),(5,"rightleg")]
[(0,"head"),(1,"body"),(2,"frontleftpaw"),(3,"frontrightpaw"),(4,"backleftpaw"),(5,"backrightpaw")]
~~~

I will continue learning Haskell, and how it relates to Category Theory, while further exploring this example from the lecture, and invite others to do the same with this and other examples. Please feel free to make suggestions.