Skip to content

Instantly share code, notes, and snippets.

MorrowM / Phantom.hs
Last active Apr 4, 2022
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 Sep 27, 2021
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 Aug 3, 2021
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