Skip to content

Instantly share code, notes, and snippets.

View mikesol's full-sized avatar
🎯
Focusing

Mike Solomon mikesol

🎯
Focusing
View GitHub Profile
@mikesol
mikesol / GenericFree.purs
Last active February 11, 2021 21:09
paluh's generic free with a few wildcards removed
module Test.RunCodegen where
import Prelude
import Control.Monad.Free (Free, liftF)
import Data.Functor.Variant (FProxy(..))
import Data.Generic.Rep (class Generic, Argument(..), Constructor(..), Product(..), Sum(..))
import Data.Generic.Rep (to) as Generics.Rep
import Data.Symbol (class IsSymbol)
import Prim.Row (class Cons, class Lacks) as Row
import Prim.Symbol (class Cons) as Symbol
@mikesol
mikesol / Thunkable.purs
Created April 8, 2021 18:38
Thunkable monad
module WAGS.Control.Thunkable where
import Prelude
import Control.Alternative (class Alt, class Alternative, class Plus, alt, empty)
import Data.Traversable (class Foldable, class Traversable, foldMapDefaultR, sequence, traverseDefault)
import Data.Tuple (Tuple(..))
data Thunkable a
= Here a
@mikesol
mikesol / Main.purs
Last active September 10, 2021 08:50
Generic to row
module Main where
import Prelude
import Data.Foldable (fold)
import Effect (Effect)
import TryPureScript (h1, h2, p, text, list, indent, link, render, code)
import Data.Generic.Rep (class Generic, Argument(..), Constructor(..), Product(..), from)
@mikesol
mikesol / Main.purs
Last active September 21, 2021 17:06
The Blue Danube Waltz
module Main where
import Prelude
import Data.NonEmpty ((:|))
import Effect (Effect)
import Halogen.Storybook (Stories, runStorybook, proxy)
import Type.Proxy (Proxy(..))
import WAGS.Lib.Learn (buffers, component, using, usingc, play)
import WAGS.Lib.Learn.Duration (crochet, crochetRest, dottedMinim, minim, semibreve)
@mikesol
mikesol / Main.purs
Last active September 25, 2021 04:41
Loop from Ableton
module Main where
import Prelude
import Control.Comonad (extract)
import Control.Comonad.Cofree ((:<))
import Control.Comonad.Cofree.Class (unwrapCofree)
import Data.Array.NonEmpty (fromNonEmpty, sortBy, toNonEmpty)
import Data.Int (toNumber)
import Data.List (List(..), (:))
@mikesol
mikesol / Main.purs
Last active September 25, 2021 04:42
Loop with pitch shift
module Main where
import Prelude
import Control.Comonad (extract)
import Control.Comonad.Cofree ((:<))
import Control.Comonad.Cofree.Class (unwrapCofree)
import Data.Array.NonEmpty (fromNonEmpty, sortBy, toNonEmpty)
import Data.Int (toNumber)
import Data.List (List(..), (:))
@mikesol
mikesol / Main.purs
Last active October 2, 2021 07:30
Tidal wags
module Main where
import Prelude hiding (between)
import Control.Alt ((<|>))
import Control.Comonad (extract)
import Control.Comonad.Cofree ((:<))
import Control.Comonad.Cofree.Class (unwrapCofree)
import Data.Array as A
import Data.Either (Either(..), hush)
@mikesol
mikesol / Main.purs
Last active September 25, 2021 14:12
F of Time
module Main where
import Prelude
import Data.NonEmpty ((:|))
import Effect (Effect)
import WAGS.Lib.Learn (play)
import WAGS.Lib.Learn.Note (accelerando, noteFromPitch_, repeat, seq)
import WAGS.Lib.Learn.Pitch (fot2, c4, d4, e4, fSharp4, gSharp4, bFlat4, c5)
import Wags.Learn.Oscillator (lfo)
@mikesol
mikesol / Main.purs
Last active September 25, 2021 14:54
Anamorphism
module Main where
import Prelude
import Data.NonEmpty ((:|))
import Effect (Effect)
import Data.Function (on)
import WAGS.Lib.Learn (play)
import WAGS.Lib.Learn.Note (accelerando, noteFromPitch_, repeat, seq)
import WAGS.Lib.Learn.Pitch (at, fuse, c4, d4, e4, fSharp4, gSharp4, bFlat4, c5, wholeTone)
@mikesol
mikesol / Main.purs
Created October 13, 2021 06:50
Avoiding unsafe
module Main where
import Prelude
import Data.Maybe (Maybe, maybe)
import Data.Traversable (traverse)
import Debug (spy)
import Effect (Effect)
import Effect.Exception (throw)
import Web.DOM.Element (getAttribute, toNode)