Skip to content

Instantly share code, notes, and snippets.

Avatar
🌊
数学者に俺は成る!

Flavio Corpa kutyel

🌊
数学者に俺は成る!
View GitHub Profile
View Autocomplete.scss
@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;
}
@Janiczek
Janiczek / elm-build-cache.mjs
Last active Feb 4, 2022
Build ~/.elm cache manually without checking SHA1 hashes
View elm-build-cache.mjs
#!/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 Jan 6, 2022
Defining a recursive datatype by its differences with another recursive datatype
View FixCoRec.hs
-- | 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 Mar 4, 2022
Baby shark as a Haskell program
View babyShark.hs
{-# 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 Feb 22, 2021
early Algebraic Data Types in Java (semicolons in 2021.. lol ;))
View adt.java
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!)
View variants-proposal.md

Variants

Author

  • Alejando Serrano (47 Degrees)

Champions

  • Searching for one ;)
@vrom911
vrom911 / ChrisPenner.hs
Created Oct 19, 2020
My solutions to the Chris Penner's 'Silly Job Interview Questions In Haskell' post: https://chrispenner.ca/posts/interview
View ChrisPenner.hs
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 Oct 9, 2020
Optics via fused-effects
View Optics.hs
{-# 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 Aug 31, 2020
Variants: the ultimate frontier
View variants.md

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.

View DList.hs
newtype DL a = DL { unDL :: [a] -> [a] }
instance Show a => Show (DL a) where
show = show . toList
instance Semigroup (DL a) where