This file contains hidden or 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
| module Main where | |
| import Data.List | |
| import Data.Maybe | |
| import Control.Monad | |
| import qualified Graphics.Rendering.OpenGL as GL | |
| import qualified Graphics.UI.GLUT as GLUT | |
| import qualified Graphics.UI.GLUT.Callbacks.Window as W | |
| import qualified Data.Map as M | |
| import Graphics.UI.GLUT.State |
This file contains hidden or 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 TypeFamilies #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE FunctionalDependencies #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| {-# LANGUAGE StandaloneDeriving #-} | |
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE Rank2Types #-} |
This file contains hidden or 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 PolymorphicComponents, StandaloneDeriving #-} | |
| module Juggling where | |
| import Data.Bits | |
| import Data.Maybe | |
| import Control.Monad | |
| import qualified Graphics.Rendering.OpenGL as GL | |
| import qualified Graphics.UI.GLUT as GLUT | |
| import qualified Graphics.UI.GLUT.Callbacks.Window as W |
This file contains hidden or 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
| module Siteswap where | |
| import Data.Bits | |
| import Data.Maybe | |
| import Control.Monad | |
| newtype Height = Height { height :: Int } deriving (Show, Eq, Ord) | |
| newtype Pattern = Pattern { pattern :: [Height] } deriving (Show, Eq) |
This file contains hidden or 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
| module MaxTree where | |
| data Tree a = Tip | Branch a (Tree a) (Tree a) | |
| maxSum :: Tree Int -> Int | |
| maxSum t = let (_, w, wo) = maxSum' t in max w wo where | |
| maxSum' :: Tree Int -> (Int, Int, Int) | |
| maxSum' Tip = (0, 0, 0) | |
| maxSum' (Branch n l r) = | |
| let (lv, wl, wol) = maxSum' l in |
This file contains hidden or 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
| module Liars where | |
| import Control.Monad | |
| import Data.List | |
| data Person = Truthteller | Liar deriving (Show, Eq) | |
| says :: Person -> Bool -> Bool | |
| says Truthteller = id | |
| says Liar = not |
This file contains hidden or 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 TypeFamilies #-} | |
| {-# LANGUAGE StandaloneDeriving #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| import Data.Function (on) | |
| import Data.List (maximumBy) | |
| class Container f where |
This file contains hidden or 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
| module Random where | |
| import System.Random (Random, randomRIO) | |
| import Control.Monad.Identity (Identity, runIdentity) | |
| import Data.Ratio | |
| import Data.List (groupBy) | |
| import Data.Function (on) | |
| import Test.QuickCheck | |
| newtype Stream m a = Stream { runStream :: m (Maybe (NonEmptyStream m a)) } |
This file contains hidden or 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
| <!doctype html> | |
| <html> | |
| <head> | |
| <script> | |
| window.onload = function() { | |
| var canvas = document.getElementById('canvas'); | |
| var context = canvas.getContext('2d'); | |
| context.globalAlpha = 0.5; |
This file contains hidden or 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
| <!doctype html> | |
| <html> | |
| <head> | |
| <script> | |
| var x, y, z; | |
| function to2d(v) { | |
| return [ |