Skip to content

Instantly share code, notes, and snippets.

@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
let
mavenix-src = fetchTarball { url = "https://github.com/icetan/mavenix/tarball/v2.3.3"; sha256 = "1l653ac3ka4apm7s4qrbm4kx7ij7n2zk3b67p9l0nki8vxxi8jv7"; };
in {
pkgs ? (import mavenix-src {}).pkgs,
mavenix ? import mavenix-src { inherit pkgs; },
src ? ./.,
doCheck ? false,
}:
let buildPhase = ''echo "derp"'';
in (mavenix.buildMaven {

Keybase proof

I hereby claim:

  • I am ssbothwell on github.
  • I am solomon_b (https://keybase.io/solomon_b) on keybase.
  • I have a public key ASC7GtVqggbQWLEuD9mswwzSx2cEpfHcMZsaMM9sHE6-ggo

To claim this, I am signing this object:

{-# LANGUAGE TupleSections #-}
class Functor f => Monoidal f where
unit :: () -> f ()
(**) :: f a -> f b -> f (a,b)
lstrength :: Functor f => (a, f b) -> f (a, b)
lstrength = undefined
bimap :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)
bimap = undefined