All Projects â†’ Risto-Stevcev â†’ haskell-church-encodings

Risto-Stevcev / haskell-church-encodings

Licence: BSD-3-Clause license
🌀 Church encodings written in Haskell

Programming Languages

haskell
3896 projects
Makefile
30231 projects

Projects that are alternatives of or similar to haskell-church-encodings

js-church-encoding
Church Encoding Implementation in JavaScript
Stars: ✭ 33 (+43.48%)
Mutual labels:  encoding, church
vorbis aotuv
"aoTuV" is library for encoding and decoding of OggVorbis
Stars: ✭ 35 (+52.17%)
Mutual labels:  encoding
apostello
sms for your church
Stars: ✭ 62 (+169.57%)
Mutual labels:  church
gonvert
Golang character encoding converter with an automatic code-estimation.
Stars: ✭ 24 (+4.35%)
Mutual labels:  encoding
enough mail
IMAP, POP3 and SMTP clients for Dart developers. Contains both low level as well as a high level API.
Stars: ✭ 78 (+239.13%)
Mutual labels:  encodings
EntityEmbedding-Working Example
This repository contains a notebook demonstrating a practical implementation of the so-called Entity Embedding for Encoding Categorical Features for Training a Neural Network.
Stars: ✭ 75 (+226.09%)
Mutual labels:  encoding
guide.encode.moe
A guide for fansubbing
Stars: ✭ 123 (+434.78%)
Mutual labels:  encoding
koa-xml-body
koa middleware to parse xml request body
Stars: ✭ 36 (+56.52%)
Mutual labels:  encoding
gbk2utf8
A flutter package to convert gbk to utf-8
Stars: ✭ 40 (+73.91%)
Mutual labels:  encoding
fastify-accepts
Add accepts parser to fastify
Stars: ✭ 51 (+121.74%)
Mutual labels:  encoding
youtube-downloader-python
You can download the YouTube video for free and convert it to any extension you want.
Stars: ✭ 20 (-13.04%)
Mutual labels:  encoding
js-multibase
JavaScript implementation of the multibase specification
Stars: ✭ 22 (-4.35%)
Mutual labels:  encoding
AMVtool
Qt GUI for FFmpeg designed for video editors.
Stars: ✭ 28 (+21.74%)
Mutual labels:  encoding
sms
A Go library for encoding and decoding SMSs
Stars: ✭ 37 (+60.87%)
Mutual labels:  encoding
InupiaqNumbers
Font for displaying Inupiaq Numerals
Stars: ✭ 27 (+17.39%)
Mutual labels:  numerals
OBS Settings Manager
Backup your OBS Studio profiles and manage them in an easy, user friendly way.
Stars: ✭ 20 (-13.04%)
Mutual labels:  encoding
morton-nd
A header-only compile-time Morton encoding / decoding library for N dimensions.
Stars: ✭ 78 (+239.13%)
Mutual labels:  encoding
gilfoyle
Distributed video encoding, hosting and streaming (WIP)
Stars: ✭ 73 (+217.39%)
Mutual labels:  encoding
Notes
My notes are about everything related to programming.
Stars: ✭ 104 (+352.17%)
Mutual labels:  encoding
BencodeNET
.NET library for encoding/decoding bencode and reading/writing torrent files
Stars: ✭ 133 (+478.26%)
Mutual labels:  encoding

Church Encodings in Haskell

This exercise was to demonstrate and play around with church encodings in a more involved way, and as a way for me to gain experience with haskell and it's type system.

Church encodings were developed by the late and famous Alonzo Church. Church is probably most well known for inventing lambda calculus, a formal branch of mathematics that introduces the notion of lambdas, or anonymous functions. You may have used them before when programming.

Church encodings are a very interesting development arising from lambda calculus. Church found out that every concept in programming languages can be represented using functions! everything from boolean logic, conditional statements, numbers (natural, integer, real, complex, imaginary), and even loops (infinite loops also)!

The most interesting thing about this is that numbers aren't anything special in math, they're just convenient placeholders. Math is really just logic in it's purest form.

Rank1Types

My first attempt at fleshing out church encodings involved absolutely no type declarations, just to see how far I can go with Haskell's Hindley-Milner type system before I needed to introduce more complicated workings. I got as far as I could go without church subtraction. It turns out that the type system starts to choke just at that type because it's too polymorphic.

RankNTypes

This is my final attempt and has worked for every church encoding I have attempted so far. I translated all of the encodings from the church encoding wikipedia page.

So far I've translated church booleans, church boolean operators, church conditionals, church comparison operators, church numerals (natural numbers), church arithmetic operators (for natural numbers), church lists, church 2-tuples, church integers, loops with the y-combinator, and church arithmetic operators (for integers) less the exponential and factorial operators.

I can still translate the leftover operators for integers, as well as real, rational, imaginary and complex numbers.

Credits

I'd like to give credit where it's due:

  • Martin's Blog for starting me off in the right direction.

  • luqui's StackOverflow post for uncovering how to move past the limitation's of Haskell's Hindley-Milner type system in order to implement church subtraction (and everything that follows it).

  • The church encoding wikipedia page for being so incredibly detailed and informative.

And finally, Church himself, for being such a badass!

Alonzo Church
Alonzo Church

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].