Skip to content

Instantly share code, notes, and snippets.

View Janiczek's full-sized avatar

Martin Janiczek Janiczek

View GitHub Profile
@Janiczek
Janiczek / Main.elm
Created January 11, 2023 17:05
Benchmark List.init
module Main exposing (..)
import Benchmark as Bench exposing (Benchmark)
import Benchmark.Runner.Alternative as Runner exposing (Program)
main : Program
main =
Runner.program suite
@Janiczek
Janiczek / Pred.elm
Last active December 4, 2022 21:34
Advent of Code 2022-04 - code synthesis
module Pred exposing (..)
import List.Cartesian
import Transform
type alias Example =
( Range, Range )
@Janiczek
Janiczek / OrderBench.elm
Created November 16, 2022 16:33
basics-extra orderBy benchmark
module OrderBench exposing (main)
{-| To run the benchmarks, first compile them with
elm make OrderBench.elm --optimize
from this folder. Then open the generated index.html file in a browser.
-}
module Helpers exposing (exprFuzzer)
import Fuzz exposing (Fuzzer)
exprFuzzer :
{ baseCases : List (Fuzzer a)
, recursiveCases : Fuzzer a -> List (Fuzzer a)
, maxDepth : Int
}
@Janiczek
Janiczek / Main.elm
Last active September 11, 2023 00:27
Free Monad + Interpreter in Elm
module Main exposing (..)
{-| Free monad + interpreter in Elm
-}
import Dict exposing (Dict)
{-| Dict String Int-like structure
@Janiczek
Janiczek / Main.elm
Created October 4, 2022 18:38
SPA navigation
main : Program Flags Model Msg
main =
Browser.application
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
, onUrlChange = PathChange
, onUrlRequest = LinkClicked
}
@Janiczek
Janiczek / README.md
Created August 19, 2022 23:51
Usage of functions from List.Extra across published packages
@Janiczek
Janiczek / README.md
Last active July 12, 2022 20:42
Elm ultisnips
@Janiczek
Janiczek / elm-make-readable.mjs
Created April 15, 2022 19:46
elm-make-readable
import fs from 'fs/promises';
const rules = [
{
rule: /var ([^=]+)( = F\d\([^f]+function)[^(]\(/gmi,
replacement: `var $1$2 __$1( `,
},
{
rule: /(\sA\d\([\s]+)([^,]+)(,[\s]+)(function[^(]+)\(/gm,
replacement: `$1$2$3$4___$2(`,
},
@Janiczek
Janiczek / 01_Exploration of elm-random limits.md
Last active April 2, 2022 08:18
Exploration of elm/random limits

Exploration of elm/random limits

The goal of this exploration is to find out what happens in Random.int 0 <N> for various N, particularly along the top end.

The generator says:

Generate 32-bit integers in a given range.

This generator can produce values outside of the range [minInt, maxInt] but sufficient randomness is not guaranteed.