Skip to content

Instantly share code, notes, and snippets.

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 / 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 /
Last active September 27, 2021 23:35
Haskell Quickstart guide 2021

Haskell Quickstart Guide (as of September 2021)


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 / Shoe.hs
Last active August 3, 2021 04:41
Tying shoes with GADTs - Complete Code
View Shoe.hs
{-# LANGUAGE DataKinds #-}
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