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
{-# OPTIONS_GHC -fno-warn-unused-imports #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
-- | A "living" module for short-lived experiments. | |
module Sketch where | |
import Algorithms.Bezier (ControlPoint (..)) |
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
taperGeometric | |
:: Double | |
-- ^ percentage to decrease by each iteration | |
-> Double | |
-- ^ Starting width | |
-> [V2 Double] | |
-- ^ The path | |
-> [(V2 Double, Double)] | |
-- ^ The path, augmented with line widths | |
taperGeometric percentage startingWidth path = zip path widths |
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 OverloadedStrings #-} | |
import Types | |
import Database.Persist.Postgresql | |
import Control.Monad.Logger | |
import Control.Monad.IO.Class | |
printIO :: (MonadIO m, Show a) => a -> m () | |
printIO = liftIO . print |
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
select ( | |
ident || 'StandardCode :: StandardCode' || E'\n' || ident || 'StandardCode = "' || standard_code || '"' || E'\n' || E'\n' || | |
ident || 'StandardId :: StandardId' || E'\n' || ident || 'StandardId = StandardKey "' || standard_id || '"' || E'\n' | |
) FROM | |
(select | |
(case when school_grade=1 then 'one' | |
when school_grade=2 then 'two' | |
when school_grade=3 then 'three' | |
when school_grade=4 then 'four' | |
when school_grade=5 then 'five' |
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 NoMonomorphismRestriction #-} | |
import Text.ParserCombinators.Parsec | |
import Text.ParserCombinators.Parsec.Token hiding (parens) | |
import Text.ParserCombinators.Parsec.Expr | |
import Control.Applicative hiding ((<|>)) | |
import Control.Monad | |
import Prelude hiding (not) | |
data Expr = Not Expr | And Expr Expr | Or Expr Expr | Var Char | SubExpr Expr deriving Eq |
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 LambdaCase #-} | |
module Main where | |
import Control.Applicative | |
import Data.Foldable | |
import Data.List.Split | |
import Data.Maybe (fromMaybe, mapMaybe) | |
import Safe |
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
graphFromFile :: String -> IO (Graph String) | |
graphFromFile f = do | |
contents <- readFile f | |
let info = map words $ lines contents | |
verts = nub . concat $ info | |
conns = map (\[a, b] -> (a, b)) info | |
graph = Graph verts conns | |
return graph |
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 RecordWildCards #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE BangPatterns #-} | |
module Main where | |
import Control.Monad.State | |
import Control.Monad.Reader | |
import Data.Text | |
import Database.MySQL.Simple |
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 OverloadedStrings #-} | |
module Main where | |
import Types | |
import Database.Persist.MySQL | |
import Control.Monad.Logger | |
import Control.Monad.IO.Class |
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 RecordWildCards #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Monad.State | |
import Control.Monad.Reader | |
import Data.Text | |
import Database.PostgreSQL.Simple | |
import Database.PostgreSQL.Simple.FromRow | |
import Database.PostgreSQL.Simple.ToRow | |
import Data.Maybe (fromJust) |