This now lives on GitHub: https://github.com/friedbrice/runhs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is some boilerplate code, don't worry about it. | |
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
main = return () | |
-- ** Start here for Interlude 1. ** | |
-- I. Types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Address = { | |
street: string | |
zipCode: string | |
} | |
type Contact = { | |
name: string | |
phoneNumber: string | |
email: string | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DataKinds, KindSignatures, GADTs, TypeOperators #-} | |
module BlockMatrix where | |
import GHC.TypeLits | |
data Block (n :: Nat) (m :: Nat) a where | |
Number :: a -> Block 1 1 a | |
Fourths :: Block n1 m1 a -> Block n1 m2 a -> Block n2 m1 a -> Block n2 m2 a -> Block (n1 + n2) (m1 + m2) a | |
Vhalves :: Block n m1 a -> Block n m2 a -> Block n (m1 + m2) a | |
Hhalves :: Block n1 m a -> Block n2 m a -> Block (n1 + n2) m a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML 1.2 | |
--- | |
# See http://www.sublimetext.com/docs/3/syntax.html | |
name: Haskell (Cabal) | |
file_extensions: | |
- cabal | |
scope: source.cabal | |
variables: | |
ident: '[a-zA-Z\_][a-zA-Z\_\-0-9]*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ghcid -c'stack repl --resolver nightly --package time' haskell-time.hs --allow-eval | |
---- | |
-- # Haskell Time Crib Sheet | |
---- | |
-- Excellent sources for this small guide include: | |
-- | |
-- * https://two-wrongs.com/haskell-time-library-tutorial.html | |
-- * https://williamyaoh.com/posts/2019-09-16-time-cheatsheet.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Concurrent (forkIO, threadDelay) | |
import Control.Monad.STM (atomically) | |
import Data.Foldable (for_) | |
import System.Environment (lookupEnv) | |
import System.Random (randomRIO) | |
import Text.Read (readMaybe) | |
import qualified Control.Concurrent.STM.TBQueue as TBQ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- monadstate-example.hs | |
-- | |
-- Load this program in GHCi: | |
-- | |
-- stack repl \ | |
-- --resolver nightly \ | |
-- --package transformers \ | |
-- --package mtl \ | |
-- monadstate-example.hs | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | A manifold is a locally-euclidean space. | |
-- | |
-- Formally, a manifold is a set @x@, together with a set @d@ of /direction | |
-- vectors/ and a rule @'step' :: (Signed d, x) -> x@ defining how the | |
-- direction vectors can be used to move around short distances on the | |
-- manifold. Each manifold has a /dimension/, which is the cardinality of | |
-- its set of direction vectors. | |
-- | |
-- Instances are expected to satisfy the following laws: | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: list | |
list: ## Show available targets. | |
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##\s*\(.*\)/\n\t\1\n/' | |
.PHONY: clean | |
clean: ## Delete project-local Npm and Spago caches. | |
rm -rf .cache | |
rm -rf .psci_modules | |
rm -rf .spago | |
rm -rf dist |