Skip to content

Instantly share code, notes, and snippets.

Avatar
🐫
🐫.P(🐫) → ∅ ≡ (∃🐫.P(🐫)) → ∅

Yuriy Pitomets Pitometsu

🐫
🐫.P(🐫) → ∅ ≡ (∃🐫.P(🐫)) → ∅
View GitHub Profile
@Pitometsu
Pitometsu / chat.log
Created Apr 18, 2022
partial application
View chat.log
Yan Shkurinskiy, [18/4/22 8:41 AM]
foo :: Int -> Int
foo x = map fib [0..] !! x
where
fib 0 = 1
fib 1 = 1
fib n = foo (n-2) + foo (n-1)
foo :: Int -> Int
foo = (map fib [0..] !!)
View solution.hs
#! /usr/bin/env nix-shell
#! nix-shell --show-trace --pure -Q -i "runghc --ghc-arg=-main-is --ghc-arg=Solution.main" -p "ghc.withPackages (pkgs: with pkgs; [ either text ])" -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/cf7475d2061ac3ada4b226571a4a1bb91420b578.tar.gz
-- You'll need nix to automatically download the dependencies:
-- `{ curl https://nixos.org/nix/install | sh ; } && . ~/.nix-profile/etc/profile.d/nix.sh`
{-# LANGUAGE OverloadedStrings
, PatternSynonyms #-}
import Prelude hiding (lookup)
@Pitometsu
Pitometsu / default.nix
Created Nov 16, 2020
./nix/channel/default.nix
View default.nix
let
channel = with builtins; fromJSON
(readFile ./lock);
in fetchTarball {
url = "https://github.com/NixOS/nixpkgs-channels/archive/" +
"${channel.rev}.tar.gz";
inherit (channel) sha256;
}
View HaskellBooks.md
  • Algorithm Design with Haskell
  • Beginning Haskell: A Project-Based Approach
  • Developing Web Apps with Haskell and Yesod
  • Functional Design and Architecture
  • Get Programming with Haskell
  • Haskell Book
  • Haskell Cookbook
  • Haskell Data Analysis Cookbook
  • Haskell Design Patterns
  • Haskell from the Very Beginning
@Pitometsu
Pitometsu / Term.java
Created May 19, 2020 — forked from jbgi/Term.java
Generalized Algebraic Data Types (GADT) in Java
View Term.java
import static java.lang.System.*;
import java.util.function.BiFunction;
import java.util.function.Function;
// Implementation of a pseudo-GADT in Java, translating the examples from
// http://www.cs.ox.ac.uk/ralf.hinze/publications/With.pdf
// The technique presented below is, in fact, just an encoding of a normal Algebraic Data Type
// using a variation of the visitor pattern + the application of the Yoneda lemma to make it
// isomorphic to the targeted 'GADT'.
@Pitometsu
Pitometsu / layout0.json
Last active May 6, 2020
Crysalis keyboard layout for keyboardio
View layout0.json
{
"keymap": [
{
"keyCode": 30,
"label": "1",
"extraLabel": "!"
},
{
"keyCode": 31,
"label": "2",
@Pitometsu
Pitometsu / layout0.json
Last active Mar 27, 2020
Chrysalis keyboardio layouts
View layout0.json
{
"keymap": [
{
"keyCode": 2079,
"label": "@"
},
{
"keyCode": 2078,
"label": "!"
},
@Pitometsu
Pitometsu / constraints.hs
Created Mar 13, 2020
constraints family
View constraints.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE PolyKinds #-}
import Data.Kind (Constraint)
type family All (c :: k -> Constraint) ts :: Constraint where All c '[] = (); All c (t:ts) = (c t, All c ts)
View hello_world.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE UnicodeSyntax #-}
@Pitometsu
Pitometsu / even.ml
Last active Dec 1, 2019
Even: Coq to OCaml
View even.ml
type _ num =
| Zero : zero num
| Succ : ('a num) -> 'a plus num
and _ plus = Plus : 'a num -> 'a plus
and zero = [ ]
;;
type _ even =
| Even_0 : zero num even
| Even_S : 'a num odd -> 'a plus num even
and _ odd =