for your convinience this instuction is available as:
gist
git repo
# settings
| -- http://www.cs.ox.ac.uk/ralf.hinze/SSGIP10/AdjointFolds.pdf | |
| -- http://www.cs.ox.ac.uk/ralf.hinze/publications/SCP-78-11.pdf | |
| -- https://www.cs.ox.ac.uk/people/nicolas.wu/papers/URS.pdf | |
| -- https://arxiv.org/pdf/2202.13633.pdf | |
| {-# LANGUAGE | |
| MultiParamTypeClasses | |
| , FunctionalDependencies | |
| , GADTs | |
| , PolyKinds |
| module Mat where | |
| open import Function | |
| open import Data.Empty | |
| open import Data.Nat using (ℕ; zero; suc) | |
| open import Data.Fin using (Fin; zero; suc; toℕ) | |
| open import Data.Fin.Props using () | |
| open import Data.Product | |
| open import Relation.Nullary | |
| open import Relation.Binary |
Find it here: https://github.com/bitemyapp/learnhaskell
| using System; | |
| namespace PureIO { | |
| /* | |
| C# does not have proper sum types. They must be emulated. | |
| This data type is one of 4 possible values: | |
| - WriteOut, being a pair of a string and A | |
| - WriteErr, being a pair of a string and A | |
| - readLine, being a function from string to A |
| module type Functor = sig | |
| type 'a t | |
| val map : ('a -> 'b) -> 'a t -> 'b t | |
| end | |
| module type Lens = sig | |
| type a | |
| type b | |
| module Make(F : Functor) : sig |
| #include <tr1/type_traits> | |
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| // (* -> *) -> Constraint | |
| template<template <typename> class T> | |
| class Functor { | |
| public: | |
| template <typename A, typename B> |
| //Provide an implementation of the abstract class Nat that represents non-negative integers | |
| // | |
| //Do not use standard numerical classes in this implementation. | |
| //Rather, implement a sub-object and sub-class: | |
| // | |
| //class Zero : Nat | |
| //class Succ(n: Nat) : Nat | |
| // | |
| //One of the number zero, then other for strictly positive numbers. | |
| namespace Nat |
| yonedaLemma = Iso (flip fmap) ($ id) |