Skip to content

Instantly share code, notes, and snippets.

foldRight' ::
(b -> z -> z)
-> (a -> b)
-> z
-> [a]
-> z
foldRight' _ _ z [] =
z
foldRight' k f z (x:xs) =
k (f x) (foldRight' k f z xs)
@qnikst
qnikst / events.markdown
Last active September 15, 2023 17:13
Предстоящие Haskell события

Предстоящие события

  • 2023-09-26 Казань. Митап по функциональному программированию в Казани Регистрация

    Темы:

    — про software transactional memory (STM) и том, какие проблемы она решает;

— как работать с иммутабельными данными удобно и без боли.

@Lysxia
Lysxia / containers.v
Last active September 25, 2019 05:02
Set Implicit Arguments.
Set Contextual Implicit.
Record container : Type := {
shape : Type;
pos : shape -> Type;
}.
Inductive ext (c : container) (a : Type) : Type := {
this_shape : shape c;
@pi8027
pi8027 / demo.v
Last active September 25, 2019 03:26
Validating Mathematical Structures (Coq Workshop 2019)
Section from_ssrfun.
Local Set Implicit Arguments.
Local Unset Strict Implicit.
Local Unset Printing Implicit Defensive.
Variables S T R : Type.
Definition left_inverse e inv (op : S -> T -> R) := forall x, op (inv x) x = e.
@kosmikus
kosmikus / Tutorial.hs
Last active May 1, 2020 23:59
Preliminary rewrite of Gabriel's lens tutorial to use `optics` instead of `lens`
{-| This @lens@ tutorial targets Haskell beginners and assumes only basic
familiarity with Haskell. By the end of this tutorial you should:
* understand what problems the @lens@ library solves,
* know when it is appropriate to use the @lens@ library,
* be proficient in the most common @lens@ idioms,
* understand the drawbacks of using lenses, and:

Introduction

I was recently asked to explain why I felt disappointed by Haskell, as a language. And, well. Crucified for crucified, I might as well criticise Haskell publicly.

First though, I need to make it explicit that I claim no particular skill with the language - I will in fact vehemently (and convincingly!) argue that I'm a terrible Haskell programmer. And what I'm about to explain is not meant as The Truth, but my current understanding, potentially flawed, incomplete, or flat out incorrect. I welcome any attempt at proving me wrong, because when I dislike something that so many clever people worship, it's usually because I missed an important detail.

Another important point is that this is not meant to convey the idea that Haskell is a bad language. I do feel, however, that the vocal, and sometimes aggressive, reverence in which it's held might lead people to have unreasonable expectations. It certainly was my case, and the reason I'm writing this.

Type classes

I love the concept of type class

@maxidorius
maxidorius / notes.md
Last active November 16, 2023 00:05
Notes on privacy and data collection of Matrix.org

Notes on privacy and data collection of Matrix.org


This version of the document is no longer canonical. You can find the canonical version hosted at Gitlab and Github.

PART 2 IS OUT, INCLUDING THE DISCLOSURE OF A GLOBAL FEDERATION DATA LEAK, AND THE ANATOMY OF A GDPR DATA REQUEST HANDLED BY MATRIX.ORG. SEE THE REPOS ABOVE.

@garazdawi
garazdawi / bit_vector.erl
Last active June 9, 2023 17:42
A shared mutable bit-vector in Erlang
-module(bit_vector).
-export([new/1, get/2, set/2, clear/2, flip/2, print/1]).
new(Size) ->
Words = (Size + 63) div 64,
{?MODULE, Size, atomics:new(Words, [{signed, false}])}.
get({?MODULE, _Size, Aref}, Bix) ->
@chrispsn
chrispsn / kOS.md
Last active March 13, 2024 03:25
A summary of everything we know about kOS.
@bryanhuntesl
bryanhuntesl / presentation.md
Created June 28, 2018 09:27 — forked from slfritchie/presentation.md
Erlang tracing, for the Riak source code reading series, 2014-03-18, Tokyo, Japan

Erlang Tracing: more than you wanted to know

Rough Outline

  • What can be traced?
  • How can trace events be specified?
  • "match specifications": twisty passages, all alike
  • WTF, can I just use DTrace and drink my coffee/beer/whisky in peace?
  • Trace delivery mechanisms: pick one of two