Skip to content

Instantly share code, notes, and snippets.

View danidiaz's full-sized avatar

Daniel Díaz Carrete danidiaz

View GitHub Profile
danidiaz /
Created January 7, 2022 14:11 — forked from jdhom/
Mistel Barocco MD600 Programming and Firmware

Mistel Barocco MD600 RGB Split Keyboard

keyboard firmware

What I remap

CapsLock is RCTRL    ... i do this on all keyboards
FN CapsLock is RCTRL ... was accidently toggling capslock with fn+capslock
LCTRL is FN ... arrow/pg/home on right half, FN+arrow I now prefer on ALL keyboards... so nice
danidiaz / Joining CSV Tables in
Created October 23, 2017 13:25 — forked from nkpart/Joining CSV Tables in
Joining CSV Tables in Haskell

Joining CSV Tables in Haskell

This article describes a technique for joining (in an SQL-style) lists of haskell data structures.

Maybe not the fastest, maybe not the smartest, but it works.

Why I like it

Advanced Functional Programming with Scala - Notes

Copyright © 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
danidiaz / gist:7c32a36612069d278d81c35d7c36472d
Created July 14, 2017 20:41 — forked from igal/gist:53855
.gitrc aliases for common git commands
# Aliases for common git commands. E.g., enter "git d" for "git diff"
# These settings live in the ~/.gitconfig file.
b = branch
ba = branch -a
ci = commit
co = checkout
d = diff
dc = diff --cached

1. Separation of immutable and mutable logic

Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a "functional core, imperative shell" seems to be the most voiced.

"Boundaries" - Gary Bernhardt

"Imperative shell" that wraps and uses your "functional core".. The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately. Functional core — Many fast unit tests. Imperative shell — Few integration tests

-- The meta-circular interpreter from section 5 of Reynolds's Definitional
-- Interpreters for Higher Order Programming Languages
-- (
data EXP
= CONST Const
| VAR Var
| APPL Appl
| LAMBDA Lambda
| COND Cond
danidiaz /
Created September 14, 2016 14:30 — forked from Icelandjack/
Type Classes and Constraints

Reddit discussion.

Type classes are a language of their own, this is an attempt to document some features.

Work in progress.

Type classes without methods — Constraining types, precluding exotic types

(Hackage) EDSL, Ivory

-- | Things that can be safely stored in references.
danidiaz / OverloadedRecords.hs
Last active August 5, 2016 16:44 — forked from tfausak/OverloadedRecords.hs
Overloaded records in Haskell.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Printf
%default total
data Format = FInt Format -- %d
| FString Format -- %s
| FOther Char Format -- [a-zA-Z0-9]
| FEnd --
format : List Char -> Format
danidiaz / TypeFamily.hs
Created January 8, 2016 15:49 — forked from deech/TypeFamily.hs
Searching a type level list using typeclasses vs. closed type families.
This code shows how to check if a type-level list contains a given type.
It first shows the approach required for older versions of GHC (< 7.6.x)
and then a version using closed type families supported in GHC 7.8.1 and greater.
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}