Skip to content

Instantly share code, notes, and snippets.

View winitzki's full-sized avatar
💭
Working on "Science of Functional Programming" book

Sergei Winitzki winitzki

💭
Working on "Science of Functional Programming" book
View GitHub Profile
@winitzki
winitzki / C.agda
Created March 7, 2024 08:10 — forked from Lysxia/C.agda
(∀ {r} → (a → Maybe r) → Maybe r) ≡ ((f : a → Bool) → Maybe (∃[ x ] f x ≡ true)) https://stackoverflow.com/questions/75178350/can-one-simplify-the-codensity-monad-on-maybe
{-# OPTIONS --without-K #-}
module C where
open import Function
open import Relation.Binary.PropositionalEquality as Eq using (_≡_; refl; trans; cong; sym)
open import Data.Empty
open import Data.Bool
open import Data.Product as Prod using (∃-syntax; Σ-syntax; _,_; _×_; ∃; proj₁; proj₂)
open import Data.Maybe as Maybe using (Maybe; just; nothing; is-just)
open import Data.Sum as Sum using (_⊎_; inj₁; inj₂)
@winitzki
winitzki / keybase-io-winitzki-proof-of-identity
Created March 28, 2019 00:00
Proof of keybase.io identity for Sergei Winitzki on Github
### Keybase proof
I hereby claim:
* I am winitzki on github.
* I am winitzki (https://keybase.io/winitzki) on keybase.
* I have a public key ASCGlyC2foE8dsomD34cEbdGXNtkOVwUbyRSnQ3vwSV_Igo
To claim this, I am signing this object:

Advanced Functional Programming with Scala - Notes

Copyright © 2016-2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x