Skip to content

Instantly share code, notes, and snippets.

View kutyel's full-sized avatar
🌊
数学者に俺は成る!

Flavio Corpa kutyel

🌊
数学者に俺は成る!
View GitHub Profile
@robrix
robrix / Optics.hs
Created October 9, 2020 15:05
Optics via fused-effects
{-# LANGUAGE RankNTypes #-}
module Optics where
import Control.Category ((>>>))
import qualified Control.Category as Cat
import Control.Effect.Empty
import Control.Effect.NonDet hiding (empty)
import Control.Monad ((<=<))
-- riffing off of @serras’s post https://gist.github.com/serras/5152ec18ec5223b676cc67cac0e99b70
@serras
serras / variants.md
Created August 31, 2020 19:37
Variants: the ultimate frontier

Variants: the ultimate frontier

Most data serialization formats, like JSON, YAML, and EDN, feature a similar set of basic building blocks, namely:

  • Some primitive values, like numbers, strings, and booleans;
  • Key-value pairs, also known as maps, dictionaries, or objects;
  • Sequences, usually in the form of lists or arrays, and sometimes also sets.

I completely agree with the fact that those are basic building blocks for data inside any information system. However, as a Haskeller I always miss one additional part of my toolbox: variants. Variants are essentially tagged values which contain further values inside.

newtype DL a = DL { unDL :: [a] -> [a] }
instance Show a => Show (DL a) where
show = show . toList
instance Semigroup (DL a) where
@techtheriac
techtheriac / lambdajs.md
Last active December 28, 2020 20:19
A subtle introduction to Lambda Calculus for the JavaScript Developer

Lambda (λ) Calculus For Javascript Developers

This article aims at explaining lambda calculus in a more approachable less 'mathy' manner.

Terms That Are Good To Know

  • Memoization: Memoization is an optimization technique used primarily to speed up computer programs by caching the result of expensive function calls and returning the cached result when fed with the same input.

  • Pure Function: A pure function is a function whose computation does not depend on globally declared variables, it does no I/O or mutations. All it does is return a value after doing a bunch of computations on the arguments it recieves. For a given set of arguments, a pure function will always return the same value. Thus, a pure function is one that is memoizable.

@kutyel
kutyel / StarWars.elm
Created March 18, 2020 10:18
Elm 0.19.1 GraphQL Star Wars Example!
module Main exposing (main)
import Browser
import GraphQL.Client.Http as GraphQLClient
import GraphQL.Request.Builder exposing (..)
import Html exposing (Html, div, text)
import Task exposing (Task)
{-| Responses to `starWarsRequest` are decoded into this type.

Monads and delimited control are very closely related, so it isn’t too hard to understand them in terms of one another. From a monadic point of view, the big idea is that if you have the computation m >>= f, then f is m’s continuation. It’s the function that is called with m’s result to continue execution after m returns.

If you have a long chain of binds, the continuation is just the composition of all of them. So, for example, if you have

m >>= f >>= g >>= h

then the continuation of m is f >=> g >=> h. Likewise, the continuation of m >>= f is g >=> h.

@dmjio
dmjio / Main.hs
Last active January 7, 2023 17:21
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
module Main where
{ nixpkgs ? (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.09.tar.gz)
, system ? builtins.currentSystem
}:
let
haskellnix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz);
overlay = _: pkgs:
let
hnPkgs = pkgs.haskell-nix.stackProject {
src = ./.;
@esokullu
esokullu / instagram.graphql
Created December 7, 2019 11:42
Instagram GraphQL Schema
enum _ModelMutationType {
CREATED
UPDATED
DELETED
}
type _QueryMeta {
count: Int!
}
@ykarikos
ykarikos / FTN-Tupas.md
Last active March 24, 2025 08:47
FTN Test accounts and personal ID numbers for Finnish bank authentication

Finnish Trust Network (FTN)

Uses OIDC (OpenID connect) or SAML 2.0 See also: https://developer.signicat.com/identity-methods/ftn/test/

Bank Personal ID number (Hetu) Firstname Lastname Username Password
Nordea 010200A9618 Onni Juhani Korhonen DEMOUSER1
Nordea 291292-918R Aino Olivia Virtanen DEMOUSER2
Nordea 030883-925M Eino Ilmari Mäkinen DEMOUSER3