Skip to content

Instantly share code, notes, and snippets.

View dmalikov's full-sized avatar
🥞
!

Dmitry Malikov dmalikov

🥞
!
View GitHub Profile
@sjoerdvisscher
sjoerdvisscher / adjointFoldPlain.hs
Last active July 26, 2023 13:04
Adjoint folds, using regular Category from base (but custom Functor)
-- 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
@yantonov
yantonov / install-ghc-ubuntu.md
Last active June 11, 2020 09:20
How to install latest GHC from source + latest stack + cabal + cabal-install on ubuntu

How to install GHC from source + latest stack + cabal + cabal-install on ubuntu

for your convinience this instuction is available as:
gist
git repo

preferred way install stack than install ghc

stack (package manager and build tool, preferrered way to manage dependencies)

# settings
@copumpkin
copumpkin / Mat.agda
Last active August 29, 2015 13:56
"Simple" matrix math for Agda
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
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@tonymorris
tonymorris / PureIO.cs
Last active April 2, 2022 16:23
A demonstration of pure-functional I/O using the free monad in C#
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
@NicolasT
NicolasT / lens.ml
Created November 30, 2013 00:39
Encoding "van Laarhoven" lenses in OCaml
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
@mxswd
mxswd / Monad.cc
Last active December 28, 2015 07:49
#include <tr1/type_traits>
#include <iostream>
#include <vector>
#include <algorithm>
// (* -> *) -> Constraint
template<template <typename> class T>
class Functor {
public:
template <typename A, typename B>
@akimboyko
akimboyko / Nat.fs
Created October 17, 2013 05:47
Quiz from Functional Programming Principles in Scala by Martin Odersky, lecture 4.2 implemented on F# with unittests
//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
anonymous
anonymous / Haskell
Created October 7, 2013 19:22
Comparison of the straightforward embedding of a basic tenet of category theory in Scala vs Haskell.
yonedaLemma = Iso (flip fmap) ($ id)
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.