GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - thma/lambda-cat: Compiling typed lambda calculus to closed cartesian categories

BranchesTags
Open more actions menu

Latest commit

 

History

37 Commits
37 Commits

Folders and files

NameName
Last commit message
Last commit date
.ipynb_checkpoints
.ipynb_checkpoints
 
 
app
app
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.~lock.lambda-cat-logo.odp#
.~lock.lambda-cat-logo.odp#
 
 
Closed Cartesian Categories and the SKI Combinators.ipynb
Closed Cartesian Categories and the SKI Combinators.ipynb
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Setup.hs
Setup.hs
 
 
Untitled1.ipynb
Untitled1.ipynb
 
 
lambda-cat-logo.odp
lambda-cat-logo.odp
 
 
lambda-cat-logo.png
lambda-cat-logo.png
 
 
lambda-cat-logo.xcf
lambda-cat-logo.xcf
 
 
package.yaml
package.yaml
 
 

Repository files navigation

Lambda Cat

This is still heavily work in progress!!!

Mieke the official lambda cat 2021

disclaimer:

This code is based on Philip Zuckers http://www.philipzucker.com/compiling-to-categories-3-a-bit-cuter/

I forked from a specific branch of his repository. All the really complicated stuff is his invention. I just filled the blanks, cleaned up the code a bit and added an interpreter that executes CCC code.

Introduction

Recently I read the very interesting Compiling to Categories paper by Conal Elliot.

He presents the idea to compile haskell programs into expressions of cartesian closed categories by λ-elimination. These expressions can then be used for different purposes like alternative program evaluation, graphic representation of program graphs, designing hardware layouts for algorithms, etc.

Cartesian Closed Categories (CCC)

In his famous paper Compiling to Categories Conal Elliot describes a way to compile from simply typed lambda-calculus terms to cartesian closed categories(CCC).

At the core of his approach sits a transformation from lambda-terms to CCC expressions that are done by eliminating variables by an abstraction function absCCC (again in pseudo-Haskell):

absCCC (\x -> x)   = id
absCCC (\x -> y)   = const y
absCCC (\x -> p q) = apply . ((\x -> p) △ (\x -> q))

Where (△) is introduced by the Cartesian category:

class Category k => Cartesian k where
  (△) :: (a `k` c) -> (a `k` d) -> (a `k` (c, d))

In the (->) instance of Cartesian (△) is defined as:

(△):: (t -> a) -> (t -> b) -> t -> (a, b)
(f △ g) x = (f x, g x)

And where apply is introduced by the Closed category:

class Cartesian k => Closed k where
  apply :: ((a -> b), a) `k` b

In the (->) instance of Closed apply is defined as

apply :: (a -> b, a) -> b
apply (f, x) = f x

About

Compiling typed lambda calculus to closed cartesian categories

Resources

Readme
Apache-2.0 license
Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.