Skip to content

Instantly share code, notes, and snippets.

server = Server.make_dispatch(Server.Filter.path(["app1"]),
| {~path ...} -> Resource.html("Test", <>This is application 1, with path {List.to_string(path)}</>)
)
server = Server.make_dispatch(Server.Filter.path(["app2"]),
| {~path ...} -> Resource.html("Test", <>This is application 2, with path {List.to_string(path)}</>)
)
server = Server.simple_dispatch(
| {~path ...} -> Resource.html("Test", <>No application, this is {List.to_string(path)}</>)
@osa1
osa1 / checked.hs
Created February 24, 2017 20:02
lightweight checked exceptions with freer
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE IncoherentInstances #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
type name default problem
Opt_WarnDuplicateExports duplicate-exports on
Opt_WarnOverflowedLiterals overflowed-literals on
Opt_WarnEmptyEnumerations empty-enumerations on
Opt_WarnMissingFields missing-fields on
Opt_WarnMissingMethods missing-methods on
Opt_WarnOverlappingPatterns overlapping-patterns on
@hsyl20
hsyl20 / ghc_gitlab.user.js
Created January 14, 2019 16:16
Add some buttons to Gitlab instance of GHC
// ==UserScript==
// @name Gitlab discussion helper
// @version 1
// @grant none
// @description This script let you toggle all discussions in Gitlab
// @include https://gitlab.haskell.org/*
// @run-at document-idle
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
@munificent
munificent / generate.c
Last active September 15, 2024 03:16
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
notacji C7+ używam jako skrótu Cmaj7 
  (a więc nie oznacza to C z podniesioną kwintą i septymą małą (C5+7), tylko C z septymą wielką) 
d7(f-c-d) oznacza, że tak można grać prawą rękę akordu d7
(D) oznacza, że można tu zagrać D lub nie zagrać
d0 to czterodźwięk D zmniejszony (D-F-Ab-Cb)
d07 to czterodźwięk D półzmniejszony (D-F-Ab-C)
E< to trójdźwięk E zwiększony
|| oznacza początek nowego taktu

dziękuję wszystkim oryginalnym autorom, krytykom, muzom

@phadej
phadej / Mokhov.agda
Created July 1, 2021 08:56
Mokhov is (at least) skew monoidal product, see https://arxiv.org/pdf/1201.4981.pdf
{-# OPTIONS --cubical --type-in-type #-}
module Mokhov where
open import Cubical.Foundations.Everything
open import Cubical.Data.Sum
open import Cubical.Data.Prod
open import Cubical.Data.Unit
record Mokhov (F : Set → Set) (G : Set → Set) (A : Set) : Set where
constructor mokhov
@bitonic
bitonic / vectorized-atan2f.cpp
Last active August 9, 2024 12:54
Vectorized & branchless atan2f
// Copyright (c) 2021 Francesco Mazzoli <[email protected]>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
import qualified Data.Set as S
import Data.Set (Set)
import Data.Char (isLower)
import Data.Ord (comparing, Down (Down))
import Data.List (sortBy, subsequences, minimumBy, maximumBy)
import Control.Monad.Trans.Writer.CPS
import Data.Monoid
import Data.Foldable (traverse_)
wordFilter :: String -> Bool
cabal-version: 2.4
name: Squeeze
version: 0.1.0.0
author: Ignat Insarov
maintainer: [email protected]
library
hs-source-dirs: .
build-depends: base, distributive
default-language: Haskell2010