Skip to content

Instantly share code, notes, and snippets.

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

Flavio Corpa kutyel

🌊
数学者に俺は成る!
View GitHub Profile
@kutyel
kutyel / Autocomplete.scss
Created September 20, 2022 11:32
Elm Autocomplete
@use '_share/src/zindex' as zindex;
@use '_share/src/Platform2/colors' as P2Colors;
@use '_share/src/Platform2/Scrollbar/style' as Scrollbar;
@mixin autocomplete {
&--search-icon {
margin-left: -8px;
margin-right: -4px;
height: 32px;
}
@Lysxia
Lysxia / T.agda
Created September 12, 2022 19:01
Traversables as Graded functors
-- Traversables as Graded functors
-- Graded functors as functors that commute with grading
--
-- Graded endofunctors on KleisliApp are Traversables
--
-- Laws omitted.
module T where
open import Level
@Janiczek
Janiczek / elm-build-cache.mjs
Last active February 4, 2022 00:39
Build ~/.elm cache manually without checking SHA1 hashes
#!/usr/bin/env node
// the .mjs extension is important
// run this inside the directory containing the `elm.json` file
// (if it's not executable, run `chmod +x elm-build-cache.mjs`)
// with VERBOSE=1 env var it will show you results of the exec commands
import fs from 'fs/promises';
import {exec} from 'child_process';
@gelisam
gelisam / FixCoRec.hs
Created January 6, 2022 05:19
Defining a recursive datatype by its differences with another recursive datatype
-- | In response to https://twitter.com/_gilmi/status/1478846678409035779
--
-- The challenge is three-fold:
--
-- 1. define the type 'Expr2' as "the same as 'Expr1' but with this constructor
-- instead of that one", without having to repeat all the other constructors.
-- 2. convert from 'Expr1' to 'Expr2' by only providing a translation for the
-- one constructor which is different.
-- 3. write a polymorphic function which works with both 'Expr1' and 'Expr2'
-- because it doesn't touch the constructor which differs.
@chiroptical
chiroptical / babyShark.hs
Last active February 3, 2023 15:23
Baby shark as a Haskell program
{-# LANGUAGE BlockArguments #-}
module Main where
main :: IO ()
main = do
babyShark
do do do do do do babyShark
do do do do do do babyShark
do do do do do do babyShark
@bond15
bond15 / adt.java
Last active February 22, 2021 09:13
early Algebraic Data Types in Java (semicolons in 2021.. lol ;))
package adt;
public class ADT {
// sealed is an experimental feature (requrires feature preview flag) of Java 15
public sealed interface Expr
permits Const, Plus, Times {
}
// records in Java 15
// records are Scala's Case Class (I'll admit Record is a much better and more accurate name!)
{- Derive Monad for a type like @Pipe@, which is isomorphic to a @Free@ monad
@
data Pipe i o a
= Input (i -> Pipe i o a)
| Output o (Pipe i o a)
| Return a
deriving Generic
@

Variants

Author

  • Alejando Serrano (47 Degrees)

Champions

  • Searching for one ;)
@vrom911
vrom911 / ChrisPenner.hs
Created October 19, 2020 20:43
My solutions to the Chris Penner's 'Silly Job Interview Questions In Haskell' post: https://chrispenner.ca/posts/interview
module ChrisPenner where
import Data.Array ((!))
import Data.Foldable (for_, foldl', maximumBy)
import Data.List (sort)
import Data.Map.Strict (Map)
import Data.Ord (comparing)
import qualified Data.Array as A
import qualified Data.Map.Strict as Map
@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