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
| -- This works | |
| -- recoverF_CPS everyP (f (A 1)) B' | |
| -- and so does | |
| -- recoverF_CPS (Proxy :: Proxy ((~) Char)) (\x -> case x of A _ -> 'a'; B -> 'b') (A' 1) | |
| -- But this isn't allowed to type check: | |
| -- recoverF_CPS everyP (f B) B' | |
| -- Also note this law holds: | |
| -- recoverF_CPS everyP recoverF' = id |
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
| -- The following lets you write: | |
| -- ghci> both @All Proxy (Proxy :: Proxy (TyApp Maybe)) Just (1, 'a') | |
| -- (Just 1,Just 'a') | |
| -- | |
| -- The type involved in that example is: | |
| -- ghci> :t both @All Proxy (Proxy :: Proxy (TyApp Maybe)) | |
| -- both @All Proxy (Proxy :: Proxy (TyApp Maybe)) | |
| -- :: (forall r x. (All x, TyApp Maybe x r) => x -> r) | |
| -- -> (a, b) -> (Maybe a, Maybe b) |
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
| Definition assoc_law {g : Type} (op : g -> g -> g) := | |
| forall (x y z : g), | |
| op (op x y) z = op x (op y z). | |
| Definition left_iden_law {g : Type} (iden : g) (op : g -> g -> g) := | |
| forall (x : g), | |
| op iden x = x. | |
| Definition right_iden_law {g : Type} (iden : g) (op : g -> g -> g) := | |
| forall (x : g), |
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
| import Data.Word | |
| import Control.Applicative | |
| import Data.Vector (Vector) | |
| type EmuWord = Word32 | |
| data Emu a -- ... | |
| instance Functor Emu |
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 RankNTypes #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| import Control.Transformation | |
| import Data.Functor.Yoneda | |
| import Data.Functor.Coyoneda | |
| instance Transformation ((->) a) g (Yoneda g a) where | |
| Yoneda y # a = y 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
| {-# LANGUAGE MagicHash #-} | |
| {-# LANGUAGE CPP #-} | |
| module Main where | |
| import Prelude hiding ((*),(-)) | |
| import GHC.Exts | |
| ------------------------------------ |
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
| execute pathogen#infect() | |
| augroup HighlightTODO | |
| autocmd! | |
| autocmd WinEnter,VimEnter * :silent! call matchadd('Todo', '\(TODO\)\|\(FIXME\)\|\(XXX\)\|\(NOTE\)', -1) | |
| augroup END | |
| " No beeps | |
| set noerrorbells | |
| set visualbell |
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 GADTs, ExistentialQuantification #-} | |
| {-# LANGUAGE DataKinds, KindSignatures, TypeOperators #-} | |
| {-# LANGUAGE PolyKinds #-} | |
| {-# LANGUAGE StandaloneDeriving #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE ConstraintKinds #-} | |
| -- Inspired by the dependent-sum package | |
| import Data.Proxy |
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 GADTs #-} | |
| {-# LANGUAGE StandaloneDeriving #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| module Client where | |
| import Prelude hiding (read) | |
| import qualified Prelude | |
| import Data.List | |
| import Control.Monad | |
| import Server |
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
| $ cabal install hask | |
| Warning: cannot determine version of /usr/local/bin/jhc : | |
| "" | |
| Resolving dependencies... | |
| Configuring hask-0... | |
| Building hask-0... | |
| Preprocessing library hask-0... | |
| [1 of 9] Compiling Hask.Category ( src/Hask/Category.hs, dist/build/Hask/Category.o ) | |
| [2 of 9] Compiling Hask.Iso ( src/Hask/Iso.hs, dist/build/Hask/Iso.o ) | |
| [3 of 9] Compiling Hask.Functor.Faithful ( src/Hask/Functor/Faithful.hs, dist/build/Hask/Functor/Faithful.o ) |