Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Díaz Carrete danidiaz

  • Softtek
  • A Coruña, Spain
View GitHub Profile
View Debouncy.hs
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NumDecimals #-}
module Main where
import Control.Concurrent
import Control.Concurrent.Async
import Control.Concurrent.MVar
View _01_modify_delete_conflicts.md

conflictos modify/delete

Ejecutar este script en Git Bash crea un repositorio y lo deja en un estado de conflicto de merge:

mkdir conflicto.01
cd conflicto.01
git init --initial-branch=master
echo "zzz" > foo.txt
printf "aaa\nbbb\nccc" > bar.txt
git add .
@danidiaz
danidiaz / muchas_caras_git_checkout.md
Last active Oct 28, 2020
Las muchas caras de git checkout
View muchas_caras_git_checkout.md

Las muchas caras de git checkout

Es bien sabido que la interfaz de línea de comandos de Git es confusa. Por ejemplo,git checkout tiene distintos comportamientos no demasiado relacionados entre sí.

El primero es cambiar a una rama ya existente:

git checkout mirama

También podemos crear una nueva rama local y cambiarnos a ella:

View Splitty.hs
{-# LANGUAGE ViewPatterns #-}
module Main where
import Data.Char
import qualified Data.List
import Data.Text
data SplitState
= BreakingOnSpace
View Instrumentation.lhs
This is an example of how using "fix" and open recursion lets us instrument
functions in a way reminiscent of aspect-oriented programming.
We are going to take an evaluator function for a simple expression language,
and augument it with an interactive debugger.
But first, the unavoidable dance of extensions and imports:
> {-# LANGUAGE ScopedTypeVariables #-}
> {-# LANGUAGE MultiWayIf #-}
@danidiaz
danidiaz / ComposeLift1.hs
Last active May 31, 2020
Lifting applicative compositions to bigger compositions
View ComposeLift1.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
View TREE_CATA_JS.md

stuff I had to install

npm install webpack webpack-cli --save-dev

npm install --save-dev file-loader

npm install --save-dev typescript ts-loader

to build

@danidiaz
danidiaz / BuildRecordInteractively.hs
Last active Apr 16, 2020
A function for constructing a value of any record type (that has the required instances) by asking the user interactively for the value of each field. Depends on http://hackage.haskell.org/package/red-black-record
View BuildRecordInteractively.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ViewPatterns #-}
@danidiaz
danidiaz / Vitreous.hs
Last active Apr 7, 2020
Remember this once RecordDotSyntax lands in GHC
View Vitreous.hs
-- see also https://stackoverflow.com/questions/61079836/why-isnt-the-constraint-trick-working-in-this-manually-defined-hasfield-insta
{-# LANGUAGE DataKinds, PolyKinds, FlexibleInstances, UndecidableInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE Rank2Types #-} -- for Into, otherwise unnecessary
{-# LANGUAGE StandaloneKindSignatures #-}
module Main where
import Control.Lens
@danidiaz
danidiaz / MaybeizeProduct.hs
Last active Mar 21, 2020
Maybeize a product
View MaybeizeProduct.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
You can’t perform that action at this time.