Skip to content

Instantly share code, notes, and snippets.

View solomon-b's full-sized avatar

Solomon solomon-b

View GitHub Profile

Graphql Parser Stress Test RFC

## TL;DR

It would be really nice to have a set of GraphQL Documents which collectively express the entire GraphQL grammar. This would include atypical constructions such as random insertions of comma characters as whitespace.

## Problem Statement

{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DeriveFunctor #-}
module RecursionSchemes where
--------------------------------------------------------------------------------
import Data.Smash
import Data.Function ((&))
module Main where
import Data.Foldable
import Data.List
import qualified Data.Map.Strict as M
-- https://en.wikipedia.org/wiki/Square_lattice
-- https://en.wikipedia.org/wiki/Ulam_spiral
data Dir a = U a | D a | L a | R a
@solomon-b
solomon-b / mazerunner.hs
Created September 20, 2021 07:42
Maze Solving Algorithm using LogicT
module Main where
import Control.Monad
import Control.Monad.Logic
import Control.Monad.Logic.Class
import Control.Monad.Trans.Class
import Control.Monad.Trans.Reader
import Control.Applicative
import Data.List
\documentclass[tikz,convert={outfile=\jobname.svg}]{standalone}
%\usetikzlibrary{...}% tikz package already loaded by 'tikz' option
\begin{document}
\begin{tikzpicture}% Example:
\[\begin{tikzcd}
{(f a \oplus f b) \oplus f c} && {fa \oplus (fb \oplus fc)} & {} \\
\\
{f (a \otimes b) \oplus f c} && {f a \oplus f (b \otimes c)} \\
\\
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
module FreerMonad where
import Data.Bifunctor (first)
import Data.Functor.Sum
import Data.Functor.Contravariant
import Data.Functor.Contravariant.Coyoneda
import Data.Functor.Kan.Lan
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider, connect } from 'react-redux';
import { createStore } from 'redux';
import * as R from 'ramda';
const EMPTY = '';
const ACTION = {
ADDITEM : 'addItem',
module Main
main = print "hi, I'm an example of bidirectional typechecking"
type Var = String
data Term
= Var Var
| Abs Var Term
| App Term Term
@solomon-b
solomon-b / Sig.hs
Last active October 19, 2020 17:59
-- Notes on comonadic signal generation
time :: Store Double Double
time = store id 0
sineStore :: Double -> Store Double Double
sineStore freq = store sine 0
where
sine :: Double -> Double
sine t = sin (2 * pi * t * freq)
@solomon-b
solomon-b / SemiRepresentable.hs
Created October 12, 2020 04:53 — forked from ChrisPenner/SemiRepresentable.hs
SemiRepresentable
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
module SemiRepresentable where
import qualified Data.Map as M
import Numeric.Natural
import qualified Data.Set as S
import Data.These