Skip to content

Instantly share code, notes, and snippets.

@MorrowM
MorrowM / Main.hs
Created February 7, 2024 15:29
Sicherman Dice
View Main.hs
{-# LANGUAGE QuasiQuotes #-}
import Data.Foldable
import Data.List
import PyF
f = ([1, 2, 2, 3, 3, 4] !!) . pred
g = ([1, 3, 4, 5, 6, 8] !!) . pred
@MorrowM
MorrowM / haskell-discourse-dark-logo-script.user.js
Created June 18, 2023 03:45
Better logo for dark mode on the Haskell Discourse instance
View haskell-discourse-dark-logo-script.user.js
// ==UserScript==
// @name Haskell Discourse Dark Mode Logo
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Better dark mode logo for Haskell Discourse instance.
// @author Morrow
// @match https://discourse.haskell.org/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// ==/UserScript==
@MorrowM
MorrowM / Main.hs
Created March 21, 2023 01:23
p-norm animation using JuicyPixels
View Main.hs
module Main (main) where
import Codec.Picture
import Data.Bifunctor
import Data.Foldable
import Data.List
import Text.Printf
main :: IO ()
main = gif $ frameList (-20) 100
@MorrowM
MorrowM / Phantom.hs
Last active April 4, 2022 13:10
Type-safe Partition
View Phantom.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PatternSynonyms #-}
module Phantom where
import Data.List
newtype Part (bool :: Bool) a = Part { unPart :: [a] }
@MorrowM
MorrowM / haskell-quickstart.md
Last active September 27, 2021 23:35
Haskell Quickstart guide 2021
View haskell-quickstart.md

Haskell Quickstart Guide (as of September 2021)

Installation

On all platforms

  1. Install GHCup, this will manage all of your Haskell development tools. Follow the onscreen instructions. When it asks you if you'd like to install Haskell language server, say yes.
  2. Install the Haskell extension for VSCode. This is the front end for the Haskell Language Server (hls). If you'd like to use hls with another editor of your choice (any editor with lsp support), see this section of the hls documentation.

Creating your first Cabal project

@MorrowM
MorrowM / Shoe.hs
Last active August 3, 2021 04:41
Tying shoes with GADTs - Complete Code
View Shoe.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
module Shoe where
data ShoeState = Off | Untied | On
data Shoes l r where
PutOnL :: Shoes Off r -> Shoes Untied r
PutOnR :: Shoes l Off -> Shoes l Untied
TieL :: Shoes Untied r -> Shoes On r