Skip to content

Instantly share code, notes, and snippets.

Rufflewind / sphtrace.hs
Last active October 15, 2015 05:29 — forked from wolfiestyle/sphtrace.hs
raytracer in haskell
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as C
data Vec a = Vec { vecx, vecy, vecz :: !a }
instance Functor Vec where
fmap f (Vec x y z) = Vec (f x) (f y) (f z)
instance Applicative Vec where
pure x = Vec x x x
-- Exercise: prove Peirce’s law <=> law of excluded middle in Haskell
{-# LANGUAGE Rank2Types #-}
module PeirceLEM where
import Data.Void
type Not a = a -> Void
type Peirce = forall a b. ((a -> b) -> a) -> a