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 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 |
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
-- 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 |