├── .gitignore ├── Demo ├── DemoUtils.hs ├── EsslliMaybeDemo.hs ├── EsslliMaybeDemo.html ├── EsslliMaybeDemo.ipynb ├── EsslliMonadDemo.hs ├── EsslliMonadDemo.html ├── EsslliMonadDemo.ipynb └── EsslliMonadDemo.lhs ├── README.md ├── Readings ├── GSV-coreference-and-modality.pdf ├── barker-shan-continuations-book.pdf ├── bekki-asai-covert-movement.pdf ├── bekki-masuko.pdf ├── bekki.pdf ├── ben-avi-winter-p-98.pdf ├── kaplan-plexy.pdf ├── lfg11giorgoloasudeh1.pdf ├── shan-monads.pdf ├── wadler-1985.pdf ├── wadler-composable.pdf └── wadler-monads.pdf ├── SUMMARY.md ├── _book ├── Demo │ ├── .ipynb_checkpoints │ │ ├── EsslliMaybeDemo-checkpoint.ipynb │ │ ├── EsslliMonadDemo-checkpoint.ipynb │ │ └── Grammar-checkpoint.ipynb │ ├── DemoUtils.hi │ ├── DemoUtils.hs │ ├── DemoUtils.o │ ├── EsslliMaybeDemo.html │ ├── EsslliMaybeDemo.ipynb │ ├── EsslliMaybeDemo.lhs │ ├── EsslliMonadDemo.hs │ ├── EsslliMonadDemo.html │ ├── EsslliMonadDemo.ipynb │ └── EsslliMonadDemo.lhs ├── combined-effects │ ├── applicatives.html │ ├── dynamics.html │ ├── focus.html │ ├── index.html │ └── xforms.html ├── continuations │ ├── index.html │ ├── layers.html │ └── scope.html ├── gitbook │ ├── app.js │ ├── fonts │ │ ├── fontawesome │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── merriweather │ │ │ ├── 250.woff │ │ │ ├── 250i.woff │ │ │ ├── 400.woff │ │ │ ├── 400i.woff │ │ │ ├── 700.woff │ │ │ ├── 700i.woff │ │ │ ├── 900.woff │ │ │ └── 900i.woff │ │ └── opensans │ │ │ ├── 300.woff │ │ │ ├── 300i.woff │ │ │ ├── 400.woff │ │ │ ├── 400i.woff │ │ │ ├── 600.woff │ │ │ ├── 600i.woff │ │ │ ├── 700.woff │ │ │ └── 700i.woff │ ├── images │ │ ├── apple-touch-icon-precomposed-152.png │ │ └── favicon.ico │ ├── plugins │ │ ├── gitbook-plugin-expandable-chapters │ │ │ ├── expandable-chapters.css │ │ │ └── expandable-chapters.js │ │ └── gitbook-plugin-katex │ │ │ ├── fonts │ │ │ ├── KaTeX_AMS-Regular.eot │ │ │ ├── KaTeX_AMS-Regular.ttf │ │ │ ├── KaTeX_AMS-Regular.woff │ │ │ ├── KaTeX_AMS-Regular.woff2 │ │ │ ├── KaTeX_Caligraphic-Bold.eot │ │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ │ ├── KaTeX_Caligraphic-Regular.eot │ │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ │ ├── KaTeX_Caligraphic-Regular.woff2 │ │ │ ├── KaTeX_Fraktur-Bold.eot │ │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ │ ├── KaTeX_Fraktur-Bold.woff │ │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ │ ├── KaTeX_Fraktur-Regular.eot │ │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ │ ├── KaTeX_Fraktur-Regular.woff │ │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ │ ├── KaTeX_Main-Bold.eot │ │ │ ├── KaTeX_Main-Bold.ttf │ │ │ ├── KaTeX_Main-Bold.woff │ │ │ ├── KaTeX_Main-Bold.woff2 │ │ │ ├── KaTeX_Main-Italic.eot │ │ │ ├── KaTeX_Main-Italic.ttf │ │ │ ├── KaTeX_Main-Italic.woff │ │ │ ├── KaTeX_Main-Italic.woff2 │ │ │ ├── KaTeX_Main-Regular.eot │ │ │ ├── KaTeX_Main-Regular.ttf │ │ │ ├── KaTeX_Main-Regular.woff │ │ │ ├── KaTeX_Main-Regular.woff2 │ │ │ ├── KaTeX_Math-BoldItalic.eot │ │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ │ ├── KaTeX_Math-BoldItalic.woff │ │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ │ ├── KaTeX_Math-Italic.eot │ │ │ ├── KaTeX_Math-Italic.ttf │ │ │ ├── KaTeX_Math-Italic.woff │ │ │ ├── KaTeX_Math-Italic.woff2 │ │ │ ├── KaTeX_Math-Regular.eot │ │ │ ├── KaTeX_Math-Regular.ttf │ │ │ ├── KaTeX_Math-Regular.woff │ │ │ ├── KaTeX_Math-Regular.woff2 │ │ │ ├── KaTeX_SansSerif-Bold.eot │ │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ │ ├── KaTeX_SansSerif-Bold.woff │ │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ │ ├── KaTeX_SansSerif-Italic.eot │ │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ │ ├── KaTeX_SansSerif-Italic.woff │ │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Regular.eot │ │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ │ ├── KaTeX_SansSerif-Regular.woff │ │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ │ ├── KaTeX_Script-Regular.eot │ │ │ ├── KaTeX_Script-Regular.ttf │ │ │ ├── KaTeX_Script-Regular.woff │ │ │ ├── KaTeX_Script-Regular.woff2 │ │ │ ├── KaTeX_Size1-Regular.eot │ │ │ ├── KaTeX_Size1-Regular.ttf │ │ │ ├── KaTeX_Size1-Regular.woff │ │ │ ├── KaTeX_Size1-Regular.woff2 │ │ │ ├── KaTeX_Size2-Regular.eot │ │ │ ├── KaTeX_Size2-Regular.ttf │ │ │ ├── KaTeX_Size2-Regular.woff │ │ │ ├── KaTeX_Size2-Regular.woff2 │ │ │ ├── KaTeX_Size3-Regular.eot │ │ │ ├── KaTeX_Size3-Regular.ttf │ │ │ ├── KaTeX_Size3-Regular.woff │ │ │ ├── KaTeX_Size3-Regular.woff2 │ │ │ ├── KaTeX_Size4-Regular.eot │ │ │ ├── KaTeX_Size4-Regular.ttf │ │ │ ├── KaTeX_Size4-Regular.woff │ │ │ ├── KaTeX_Size4-Regular.woff2 │ │ │ ├── KaTeX_Typewriter-Regular.eot │ │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ │ ├── KaTeX_Typewriter-Regular.woff │ │ │ └── KaTeX_Typewriter-Regular.woff2 │ │ │ └── katex.min.css │ ├── print.css │ └── style.css ├── gsv │ ├── gsv-monad.html │ └── index.html ├── index.html ├── intro │ ├── index.html │ └── types.html ├── monad-examps │ ├── haskell.md │ ├── index.html │ ├── maybe.html │ ├── reader.html │ ├── set.md │ ├── state.html │ └── writer.html └── search_index.json ├── book.json ├── combined-effects ├── README.md ├── applicatives.md ├── dynamics.md ├── focus.md └── xforms.md ├── continuations ├── README.md ├── layers.md └── scope.md ├── gsv ├── README.md └── gsv-monad.md ├── intro ├── README.md └── types.md └── monad-examps ├── #trash.txt# ├── .#trash.txt ├── README.md ├── day2-cb.md ├── haskell.md ├── maybe.md ├── reader.md ├── set.md ├── state.md └── writer.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Node rules: 2 | ## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 3 | .grunt 4 | 5 | ## Dependency directory 6 | ## Commenting this out is preferred by some people, see 7 | ## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git 8 | node_modules 9 | 10 | # Book build output 11 | # _book 12 | 13 | # eBook build output 14 | *.epub 15 | *.mobi 16 | -------------------------------------------------------------------------------- /Demo/DemoUtils.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} 2 | {-# LANGUAGE FunctionalDependencies, UndecidableInstances #-} 3 | 4 | module DemoUtils where 5 | 6 | import Control.Monad.Writer 7 | import Control.Monad.Cont 8 | import Control.Applicative 9 | 10 | type List a = [a] 11 | 12 | runList :: List a -> [a] 13 | runList = id 14 | 15 | runMaybe :: Maybe a -> Maybe a 16 | runMaybe = id 17 | 18 | data Pair a = Pair {runPair :: (a, a)} 19 | 20 | instance Show a => Show (Pair a) where 21 | show (Pair (x, y)) = "Pair " ++ show (x, y) 22 | 23 | instance Functor Pair where 24 | fmap f (Pair (x, y)) = Pair (f x, f y) 25 | 26 | instance Applicative Pair where 27 | pure x = Pair (x, x) 28 | (Pair (uf, vf)) <*> (Pair (ux, vx)) = Pair (uf ux, vf vx) 29 | 30 | instance Monad Pair where 31 | return x = Pair (x, x) 32 | (Pair (x, y)) >>= k = Pair (fstP $ k x, sndP $ k y) 33 | where fstP (Pair (u, v)) = u 34 | sndP (Pair (u, v)) = v 35 | 36 | instance Monoid w => Monad ((,) w) where 37 | return x = (mempty, x) 38 | (w, x) >>= k = (w <> fst (k x), snd (k x)) 39 | 40 | instance Monoid w => MonadWriter w ((,) w) where 41 | writer (x, w) = (w, x) 42 | listen (w, x) = (w, (x, w)) 43 | pass (w, (x, f)) = (f w, x) 44 | 45 | instance Alternative m => Alternative (ContT r m) where 46 | empty = ContT $ const empty 47 | m <|> n = ContT $ \k -> runContT m k <|> runContT n k 48 | 49 | instance MonadPlus m => MonadPlus (ContT r m) where 50 | mzero = ContT $ const mzero 51 | m `mplus` n = ContT $ \k -> runContT m k `mplus` runContT n k 52 | 53 | instance MonadWriter w m => MonadWriter w (ContT r m) where 54 | tell w = lift (tell w) 55 | listen = undefined 56 | pass = undefined 57 | 58 | class Apply f g ret | f g -> ret where 59 | app :: f -> g -> ret 60 | instance Apply (a -> b) a b where 61 | f `app` x = f x 62 | instance Apply a (a -> b) b where 63 | x `app` f = f x 64 | instance (Monad m, Apply s t ret) => Apply (m s) (m t) (m ret) where 65 | app = liftM2 app 66 | -------------------------------------------------------------------------------- /Demo/EsslliMaybeDemo.hs: -------------------------------------------------------------------------------- 1 | 2 | import Control.Monad 3 | 4 | safediv :: Maybe Float -> Maybe Float -> Maybe Float 5 | safediv m n = m >>= \x -> n >>= \y -> if y == 0 then Nothing else Just (x / y) 6 | 7 | senGood :: Maybe Bool 8 | senGood = (return 2 `plusM` return 3) `equalsM` return 5 9 | where plusM = liftM2 (+) 10 | equalsM = liftM2 (==) 11 | 12 | -- senGood 13 | 14 | senWhoops :: Maybe Float 15 | senWhoops = return 8 `divM` (return 3 `minusM` return 3) 16 | where divM = liftM2 (/) 17 | minusM = liftM2 (-) 18 | 19 | -- senWhoops 20 | 21 | senMaybe :: Maybe Float 22 | senMaybe = return 8 `safediv` (return 3 `minusM` return 3) 23 | where minusM = liftM2 (-) 24 | 25 | -- senMaybe 26 | 27 | the :: (Int -> Bool) -> Maybe Int 28 | the cn = if length cns == 1 then Just (head cns) else Nothing 29 | where cns = filter cn domain 30 | domain = [1, 2, 3] 31 | 32 | is :: a -> (a -> Bool) -> Bool 33 | is x f = f x 34 | 35 | big, small, mediumSized :: Maybe (Int -> Bool) 36 | big = return (== 3) 37 | small = return (== 1) 38 | mediumSized = return (== 2) 39 | 40 | sen1 :: Maybe Bool 41 | sen1 = the even `isM` mediumSized 42 | where isM = liftM2 is 43 | 44 | -- sen1 45 | 46 | sen2 :: Maybe Bool 47 | sen2 = the even `isM` big 48 | where isM = liftM2 is 49 | 50 | -- sen2 51 | 52 | sen3 :: Maybe Bool 53 | sen3 = the odd `isM` big 54 | where isM = liftM2 is 55 | 56 | -- sen3 57 | -------------------------------------------------------------------------------- /Demo/EsslliMonadDemo.hs: -------------------------------------------------------------------------------- 1 | 2 | {-# LANGUAGE FlexibleInstances, FlexibleContexts #-} 3 | 4 | import Prelude hiding (log) 5 | import Control.Monad.Identity 6 | import Control.Monad.Except 7 | import Control.Monad.Reader 8 | import Control.Monad.Writer 9 | import Control.Monad.List 10 | import Control.Monad.State 11 | import Control.Monad.RWS 12 | import Control.Monad.Cont 13 | import DemoUtils 14 | 15 | data E = John | Mary deriving (Eq, Show) 16 | 17 | type T = Bool 18 | 19 | likes' :: E -> E -> T 20 | likes' x _ = x == Mary 21 | 22 | john, mary :: Monad m => m E 23 | john = return John 24 | mary = return Mary 25 | 26 | likes :: Monad m => m (E -> E -> Bool) 27 | likes = return likes' 28 | 29 | -- print (john :: Identity E) 30 | -- print (john :: Pair E) 31 | -- print (john :: List E) 32 | 33 | -- :type runIdentity 34 | -- :type runPair 35 | -- :type runList 36 | 37 | -- runIdentity john 38 | -- runPair john 39 | -- runList john 40 | 41 | -- Forward function application 42 | () :: Monad m => m (a -> b) -> m a -> m b 43 | mf mx = mf >>= \f -> 44 | mx >>= \x -> 45 | return (f x) 46 | 47 | -- Backward function application 48 | (<\>) :: Monad m => m a -> m (a -> b) -> m b 49 | mx <\> mf = mx >>= \x -> 50 | mf >>= \f -> 51 | return (f x) 52 | 53 | sen1a, sen1b :: Monad m => m Bool 54 | sen1a = john <\> (likes mary) 55 | sen1b = mary <\> (likes john) 56 | 57 | -- runIdentity sen1a 58 | -- runIdentity sen1b 59 | 60 | -- runPair sen1a 61 | -- runList sen1a 62 | 63 | data Context = Context {speaker :: E, time :: Int} 64 | 65 | thisContext :: Context 66 | thisContext = Context {speaker = John, time = 0} 67 | 68 | me :: MonadReader Context m => m E 69 | me = asks speaker 70 | -- Reader (\context -> speaker context) 71 | 72 | now :: MonadReader Context m => m Int 73 | now = asks time 74 | -- Reader (\context -> time context) 75 | 76 | sen2 :: MonadReader Context m => m Bool 77 | sen2 = mary <\> (likes me) 78 | 79 | -- runReader sen2 thisContext 80 | -- thisContext = {speaker = John, time = 0} 81 | 82 | log :: (Show a, MonadWriter String m) => m a -> m a 83 | log m = m >>= (\x -> writer (x, "Log " ++ show x ++ ". ")) 84 | 85 | sen3 :: MonadWriter String m => m Bool 86 | sen3 = log mary <\> (likes log john) 87 | 88 | -- runWriter sen3 89 | 90 | sen4 :: (MonadReader Context m, MonadWriter String m) => m Bool 91 | sen4 = mary <\> (likes log me) 92 | 93 | -- runWriter (runReaderT sen4 thisContext) 94 | 95 | someone :: MonadPlus m => m E 96 | someone = john `mplus` mary 97 | 98 | sen5a :: MonadPlus m => m Bool 99 | sen5a = someone <\> (likes mary) 100 | 101 | -- runList sen5a 102 | 103 | sen5b :: (MonadPlus m, MonadWriter String m) => m Bool 104 | sen5b = log someone <\> (likes john) 105 | 106 | -- runList (runWriterT sen5b) 107 | 108 | type Stack = List E 109 | 110 | discourseInitial, justMentionedMary :: Stack 111 | discourseInitial = [] 112 | justMentionedMary = [Mary] 113 | 114 | pro :: MonadState Stack m => m E 115 | pro = gets head 116 | 117 | sen6a :: MonadState Stack m => m Bool 118 | sen6a = mary <\> (likes pro) 119 | 120 | -- runState sen6a justMentionedMary 121 | -- runState sen6a discourseInitial 122 | 123 | proM :: (MonadError String m, MonadState Stack m) => m E 124 | proM = get >>= safeLookup 125 | where safeLookup s = 126 | if null s 127 | then throwError "Who are we talking about here?" 128 | else return (head s) 129 | 130 | sen6b :: (MonadError String m, MonadState Stack m) => m Bool 131 | sen6b = mary <\> (likes proM) 132 | 133 | -- runState (runExceptT sen6b) justMentionedMary 134 | -- runState (runExceptT sen6b) discourseInitial 135 | 136 | push :: MonadState Stack m => m E -> m E 137 | push m = m >>= \x -> state (\s -> (x, x:s)) 138 | -- = m >>= \x -> modify (x:) >>= \_ return x 139 | 140 | sen7a :: MonadState Stack m => m Bool 141 | sen7a = push mary <\> (likes pro) 142 | 143 | -- runState sen7a justMentionedMary 144 | 145 | sen7b :: (MonadState Stack m, MonadWriter String m) => m Bool 146 | sen7b = mary <\> (likes log pro) 147 | 148 | -- runWriter (runStateT sen7b justMentionedMary) 149 | 150 | sen8a :: (MonadState Stack m, MonadPlus m) => m Bool 151 | sen8a = push someone <\> (likes pro) 152 | 153 | -- runList (runStateT sen8a discourseInitial) 154 | 155 | sen8b :: (MonadState Stack m, MonadPlus m, MonadWriter String m) => m Bool 156 | sen8b = push someone <\> (likes log pro) 157 | 158 | -- runList (runRWST sen8b thisContext discourseInitial) 159 | 160 | sen8c :: (MonadPlus m, MonadRWS Context String Stack m) => m Bool 161 | sen8c = push someone <\> (likes log me) 162 | 163 | -- runList (runRWST sen8c thisContext discourseInitial) 164 | 165 | everyone :: Monad m => ContT Bool m E 166 | everyone = ContT (\k -> k John `andM` k Mary) 167 | where m `andM` n = m <\> (return (&&) n) 168 | 169 | lower :: Monad m => ContT a m a -> m a 170 | lower t = runContT t return 171 | 172 | sen9a :: Monad m => ContT Bool m Bool 173 | sen9a = everyone <\> (likes mary) 174 | 175 | -- runIdentity (lower sen9a) 176 | 177 | sen9b :: Monad m => ContT Bool m Bool 178 | sen9b = mary <\> (likes everyone) 179 | 180 | -- runIdentity (lower sen9b) 181 | 182 | sen10a :: MonadState Stack m => ContT Bool m Bool 183 | sen10a = push everyone <\> (likes mary) 184 | 185 | -- runState (lower sen10a) discourseInitial 186 | 187 | sen10b :: (MonadPlus m, MonadState Stack m, MonadWriter String m) => ContT Bool m Bool 188 | sen10b = log someone <\> (likes push everyone) 189 | 190 | -- runList (runWriterT (runStateT (lower sen10b) discourseInitial)) 191 | 192 | sen10c :: (MonadPlus m, MonadState Stack m, MonadWriter String m) => ContT Bool m Bool 193 | sen10c = push everyone <\> (likes log someone) 194 | 195 | -- runList (runWriterT (runStateT (lower sen10c) discourseInitial)) 196 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Monads and Natural Language 2 | 3 | ESSLLI Barcelona 4 | 17:00--18:30 M-F, 3-7 August 2015 5 | 6 | Instructors: Chris Barker and Dylan Bumford , 7 | *New York University, Department of Linguistics* 8 | 9 | ## Course description: 10 | 11 | Monads are a concept from the theory of programming 12 | languages that allows modular separation of main effect from side 13 | effect. For instance, if the main effect is arithmetic computation, 14 | the side effect might be reading the value of a variable from a store 15 | (a Reader monad), or sending a value to the print queue (a Writer 16 | monad), or changing the value of a variable (a State monad). Each of 17 | these side effects can be added or removed at will without 18 | disturbing the main computation. 19 | 20 | It is now well-established that natural languages expressions can be 21 | viewed as having a main ("at-issue") effect and side effects. The 22 | goal of this course is to explore how the technique of monadic 23 | programming can provide insight into semantic composition in natural 24 | language. Examples explored in detail include intensionality as a 25 | Reader monad (Winter and Ben-Avi, presented at SuB 11 at the Pompeu 26 | Fabra, and at ESSLLI in 2007); donkey-anaphora as a State monad; 27 | expressive content, as in *the damn dog*, as a Writer monad 28 | (Giorgolo and Asudeh); scope-taking as a Continuation monad (Barker 29 | and Shan 2006, 2014); and the Set monad for Hamblin-style indefinites 30 | (Charlow 2014). 31 | 32 | The course will introduce the basics of monads, including the type 33 | constructor, the unit, the bind operator, and the monad laws by 34 | developing progressively more complex concrete fragments of natural 35 | language in Haskell. The Haskell language (named for Haskell Curry) 36 | provides extensive built-in support for monads. The fragments will be 37 | applied to progressively more challenging data sets in natural 38 | language. 39 | 40 | The level of the course will be appropriate for any student who either 41 | has experience with a functional programming language (Haskell, OCaml, 42 | Scheme, etc.), or who has experience with formal models of semantic 43 | composition (Heim and Kratzer, Jacobson, Steedman, Moortgat, etc.) 44 | The course will not presume previous familiarity with any specific 45 | theory of meaning, and programming techniques will be explained from 46 | first principles; nevertheless, the course will be taught at an 47 | advanced level, and is not appropriate for students who have neither 48 | programming experience nor experience with formal semantic models. 49 | 50 | That said, the course is intended to be a way for experienced 51 | programmers to leverage their understanding of functional programming 52 | to appreciate the beauty and intricacy of natural language meaning, or 53 | else to be a way for experienced natural language semanticists to 54 | appreciate the value of functional programming techniques for gaining 55 | new insights into semantic composition. 56 | 57 | There will be simple programming exercises, as well as readings from 58 | the linguistics literature. Unger and van Eijck provides useful 59 | background on Haskell. 60 | 61 | 62 | ## Tentative schedule: 63 | 64 | * Day 1: 65 | * Introduction 66 | * Computational goals served by monads: structured computation 67 | * Linguistic goals served by monads: multi-dimensional meaning composition 68 | * Survey of applications in linguistics 69 | * Basics 70 | * Types and type classes 71 | * Monads and the monad laws 72 | * First example, presupposition failure in the "maybe" monad 73 | 74 | * Day 2: 75 | * Reader monad 76 | * Indexicals 77 | * Intensionality 78 | * Writer monad 79 | * Expressives and appositives 80 | * Set monad 81 | * Alternative semantics 82 | * Focus 83 | * State monad 84 | * Binding 85 | 86 | * Day 3: 87 | * Groenendijk, Stokhof, and Veltman's 1996 fragment 88 | * Re-engineering GSV, monadically 89 | 90 | * Day 4: 91 | * Combining effects 92 | * Dynamic semantics 93 | * Monad transformers 94 | * Demo 95 | 96 | * Day 5: Guest lecture from Simon Charlow 97 | * Monads, applicative functors, and scope 98 | -------------------------------------------------------------------------------- /Readings/GSV-coreference-and-modality.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/GSV-coreference-and-modality.pdf -------------------------------------------------------------------------------- /Readings/barker-shan-continuations-book.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/barker-shan-continuations-book.pdf -------------------------------------------------------------------------------- /Readings/bekki-asai-covert-movement.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/bekki-asai-covert-movement.pdf -------------------------------------------------------------------------------- /Readings/bekki-masuko.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/bekki-masuko.pdf -------------------------------------------------------------------------------- /Readings/bekki.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/bekki.pdf -------------------------------------------------------------------------------- /Readings/ben-avi-winter-p-98.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/ben-avi-winter-p-98.pdf -------------------------------------------------------------------------------- /Readings/kaplan-plexy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/kaplan-plexy.pdf -------------------------------------------------------------------------------- /Readings/lfg11giorgoloasudeh1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/lfg11giorgoloasudeh1.pdf -------------------------------------------------------------------------------- /Readings/shan-monads.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/shan-monads.pdf -------------------------------------------------------------------------------- /Readings/wadler-1985.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/wadler-1985.pdf -------------------------------------------------------------------------------- /Readings/wadler-composable.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/wadler-composable.pdf -------------------------------------------------------------------------------- /Readings/wadler-monads.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/Readings/wadler-monads.pdf -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [Monads and Natural Language](README.md) 4 | * [Introduction to Monads](intro/README.md) 5 | * [Types, Type Classes, and Monads](intro/types.md) 6 | * [First Example: Maybe](monad-examps/maybe.md) 7 | * [Monads, More Examples](monad-examps/README.md) 8 | * [Writer](monad-examps/writer.md) 9 | * [Reader](monad-examps/reader.md) 10 | * [Set](monad-examps/list.md) 11 | * [State](monad-examps/state.md) 12 | * [A Deeper Dive: Re-engineering GSV](gsv/README.md) 13 | * [A Monad for Intensional State](gsv/gsv-monad.md) 14 | * [Combining Effects](combined-effects/README.md) 15 | * [Transformers](combined-effects/xforms.md) 16 | * [Dynamic Semantics](combined-effects/dynamics.md) 17 | * [Applicatives](combined-effects/applicatives.md) 18 | * [Focus](combined-effects/focus.md) 19 | * [Continuations](continuations/README.md) 20 | * [Continuations for Scope](continuations/scope.md) 21 | * [Continuations for Layered Effects](continuations/layers.md) 22 | -------------------------------------------------------------------------------- /_book/Demo/.ipynb_checkpoints/EsslliMaybeDemo-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 2, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import Control.Monad" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 13, 17 | "metadata": { 18 | "collapsed": false 19 | }, 20 | "outputs": [], 21 | "source": [ 22 | "plus, minus, times, div :: Float -> Float -> Float\n", 23 | "plus x y = y + x\n", 24 | "minus x y = y - x\n", 25 | "times x y = y * x\n", 26 | "div x y = y / x\n", 27 | "\n", 28 | "equals :: Float -> Float -> Bool\n", 29 | "equals x y = y == x" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 26, 35 | "metadata": { 36 | "collapsed": false 37 | }, 38 | "outputs": [], 39 | "source": [ 40 | "safediv :: Maybe Float -> Maybe Float -> Maybe Float\n", 41 | "safediv m n = m >>= \\x -> n >>= \\y -> if y == 0 then Nothing else Just (x / y)" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 17, 47 | "metadata": { 48 | "collapsed": false 49 | }, 50 | "outputs": [], 51 | "source": [ 52 | "senGood :: Maybe Bool\n", 53 | "senGood = (return 2 `mPlus` return 3) `mEquals` return 5\n", 54 | " where mPlus = liftM2 (+)\n", 55 | " mEquals = liftM2 (==)" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": 23, 61 | "metadata": { 62 | "collapsed": false 63 | }, 64 | "outputs": [ 65 | { 66 | "data": { 67 | "text/html": [ 68 | "JustTrue" 165 | ], 166 | "text/plain": [ 167 | "Just True" 168 | ] 169 | }, 170 | "metadata": {}, 171 | "output_type": "display_data" 172 | } 173 | ], 174 | "source": [ 175 | "senGood" 176 | ] 177 | }, 178 | { 179 | "cell_type": "code", 180 | "execution_count": 27, 181 | "metadata": { 182 | "collapsed": false 183 | }, 184 | "outputs": [], 185 | "source": [ 186 | "senBad :: Maybe Float\n", 187 | "senBad = return 8 `mDiv` (return 3 `mMinus` return 3)\n", 188 | " where mDiv = liftM2 (/)\n", 189 | " mMinus = liftM2 (-)" 190 | ] 191 | }, 192 | { 193 | "cell_type": "code", 194 | "execution_count": 29, 195 | "metadata": { 196 | "collapsed": false 197 | }, 198 | "outputs": [ 199 | { 200 | "data": { 201 | "text/html": [ 202 | "JustInfinity" 299 | ], 300 | "text/plain": [ 301 | "Just Infinity" 302 | ] 303 | }, 304 | "metadata": {}, 305 | "output_type": "display_data" 306 | } 307 | ], 308 | "source": [ 309 | "senBad" 310 | ] 311 | }, 312 | { 313 | "cell_type": "code", 314 | "execution_count": null, 315 | "metadata": { 316 | "collapsed": true 317 | }, 318 | "outputs": [], 319 | "source": [] 320 | } 321 | ], 322 | "metadata": { 323 | "kernelspec": { 324 | "display_name": "Haskell", 325 | "language": "haskell", 326 | "name": "haskell" 327 | } 328 | }, 329 | "nbformat": 4, 330 | "nbformat_minor": 0 331 | } 332 | -------------------------------------------------------------------------------- /_book/Demo/DemoUtils.hi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/Demo/DemoUtils.hi -------------------------------------------------------------------------------- /_book/Demo/DemoUtils.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} 2 | {-# LANGUAGE FunctionalDependencies, UndecidableInstances #-} 3 | 4 | module GrammarUtils where 5 | 6 | import Control.Monad.Writer 7 | import Control.Monad.Cont 8 | import Control.Applicative 9 | 10 | type List a = [a] 11 | 12 | runList :: List a -> [a] 13 | runList = id 14 | 15 | runMaybe :: Maybe a -> Maybe a 16 | runMaybe = id 17 | 18 | data Pair a = Pair {runPair :: (a, a)} 19 | 20 | instance Show a => Show (Pair a) where 21 | show (Pair (x, y)) = "Pair " ++ show (x, y) 22 | 23 | instance Functor Pair where 24 | fmap f (Pair (x, y)) = Pair (f x, f y) 25 | 26 | instance Applicative Pair where 27 | pure x = Pair (x, x) 28 | (Pair (uf, vf)) <*> (Pair (ux, vx)) = Pair (uf ux, vf vx) 29 | 30 | instance Monad Pair where 31 | return x = Pair (x, x) 32 | (Pair (x, y)) >>= k = Pair (fstP $ k x, sndP $ k y) 33 | where fstP (Pair (u, v)) = u 34 | sndP (Pair (u, v)) = v 35 | 36 | instance Monoid w => Monad ((,) w) where 37 | return x = (mempty, x) 38 | (w, x) >>= k = (w <> fst (k x), snd (k x)) 39 | 40 | instance Monoid w => MonadWriter w ((,) w) where 41 | writer (x, w) = (w, x) 42 | listen (w, x) = (w, (x, w)) 43 | pass (w, (x, f)) = (f w, x) 44 | 45 | instance Alternative m => Alternative (ContT r m) where 46 | empty = ContT $ const empty 47 | m <|> n = ContT $ \k -> runContT m k <|> runContT n k 48 | 49 | instance MonadPlus m => MonadPlus (ContT r m) where 50 | mzero = ContT $ const mzero 51 | m `mplus` n = ContT $ \k -> runContT m k `mplus` runContT n k 52 | 53 | instance MonadWriter w m => MonadWriter w (ContT r m) where 54 | tell w = lift (tell w) 55 | listen = undefined 56 | pass = undefined 57 | 58 | class Apply f g ret | f g -> ret where 59 | app :: f -> g -> ret 60 | instance Apply (a -> b) a b where 61 | f `app` x = f x 62 | instance Apply a (a -> b) b where 63 | x `app` f = f x 64 | instance (Monad m, Apply s t ret) => Apply (m s) (m t) (m ret) where 65 | app = liftM2 app 66 | -------------------------------------------------------------------------------- /_book/Demo/DemoUtils.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/Demo/DemoUtils.o -------------------------------------------------------------------------------- /_book/Demo/EsslliMaybeDemo.lhs: -------------------------------------------------------------------------------- 1 | 2 | import Control.Monad 3 | 4 | safediv :: Maybe Float -> Maybe Float -> Maybe Float 5 | safediv m n = m >>= \x -> n >>= \y -> if y == 0 then Nothing else Just (x / y) 6 | 7 | senGood :: Maybe Bool 8 | senGood = (return 2 `plusM` return 3) `equalsM` return 5 9 | where plusM = liftM2 (+) 10 | equalsM = liftM2 (==) 11 | 12 | senGood 13 | 14 | senWhoops :: Maybe Float 15 | senWhoops = return 8 `divM` (return 3 `minusM` return 3) 16 | where divM = liftM2 (/) 17 | minusM = liftM2 (-) 18 | 19 | senWhoops 20 | 21 | senMaybe :: Maybe Float 22 | senMaybe = return 8 `safediv` (return 3 `minusM` return 3) 23 | where minusM = liftM2 (-) 24 | 25 | senMaybe 26 | 27 | the :: (Int -> Bool) -> Maybe Int 28 | the cn = if length cns == 1 then Just (head cns) else Nothing 29 | where cns = filter cn domain 30 | domain = [1, 2, 3] 31 | 32 | is :: a -> (a -> Bool) -> Bool 33 | is x f = f x 34 | 35 | big, small, mediumSized :: Maybe (Int -> Bool) 36 | big = return (== 3) 37 | small = return (== 1) 38 | mediumSized = return (== 2) 39 | 40 | sen1 :: Maybe Bool 41 | sen1 = the even `isM` mediumSized 42 | where isM = liftM2 is 43 | 44 | sen1 45 | 46 | sen2 :: Maybe Bool 47 | sen2 = the even `isM` big 48 | where isM = liftM2 is 49 | 50 | sen2 51 | 52 | sen3 :: Maybe Bool 53 | sen3 = the odd `isM` big 54 | where isM = liftM2 is 55 | 56 | sen3 57 | -------------------------------------------------------------------------------- /_book/Demo/EsslliMonadDemo.hs: -------------------------------------------------------------------------------- 1 | 2 | {-# LANGUAGE FlexibleInstances, FlexibleContexts #-} 3 | 4 | import Prelude hiding (log) 5 | import Control.Monad.Identity 6 | import Control.Monad.List 7 | import Control.Monad.Reader 8 | import Control.Monad.Writer 9 | import Control.Monad.State 10 | import Control.Monad.RWS 11 | import Control.Monad.Cont 12 | :load DemoUtils 13 | 14 | data E = John | Mary deriving (Eq, Show) 15 | 16 | type T = Bool 17 | 18 | likes' :: E -> E -> T 19 | likes' x _ = x == Mary 20 | 21 | john, mary :: Monad m => m E 22 | john = return John 23 | mary = return Mary 24 | 25 | likes :: Monad m => m (E -> E -> Bool) 26 | likes = return likes' 27 | 28 | print (john :: Identity E) 29 | print (john :: Pair E) 30 | print (john :: List E) 31 | 32 | :type runIdentity 33 | :type runPair 34 | :type runList 35 | 36 | runIdentity john 37 | runPair john 38 | runList john 39 | 40 | -- Forward function application 41 | () :: Monad m => m (a -> b) -> m a -> m b 42 | mf mx = mf >>= \f -> 43 | mx >>= \x -> 44 | return (f x) 45 | 46 | -- Backward function application 47 | (<\>) :: Monad m => m a -> m (a -> b) -> m b 48 | mx <\> mf = mx >>= \x -> 49 | mf >>= \f -> 50 | return (f x) 51 | 52 | sen1 = john <\> (likes mary) 53 | sen2 = mary <\> (likes john) 54 | 55 | :type sen1 56 | :type sen2 57 | 58 | runIdentity sen1 59 | runIdentity sen2 60 | 61 | runPair sen1 62 | runList sen1 63 | 64 | data Context = Context {speaker :: E, time :: Int} 65 | 66 | thisContext :: Context 67 | thisContext = Context {speaker = John, time = 0} 68 | 69 | me :: MonadReader Context m => m E 70 | me = asks speaker 71 | -- Reader (\context -> speaker context) 72 | 73 | now :: MonadReader Context m => m Int 74 | now = asks time 75 | -- Reader (\context -> time context) 76 | 77 | sen5 = mary <\> (likes me) 78 | 79 | :type sen5 80 | 81 | runReader sen5 thisContext 82 | -- thisContext = {speaker = John, time = 0} 83 | 84 | log :: (Show a, MonadWriter String m) => m a -> m a 85 | log m = m >>= (\x -> writer (x, "Log " ++ show x ++ ". ")) 86 | 87 | sen2 = log mary <\> (likes log john) 88 | 89 | :type sen2 90 | 91 | runWriter sen2 92 | 93 | senBlah = mary <\> (likes log me) 94 | 95 | :type senBlah 96 | 97 | runWriter (runReaderT senBlah thisContext) 98 | 99 | someone :: MonadPlus m => m E 100 | someone = john `mplus` mary 101 | 102 | sen3 = someone <\> (likes mary) 103 | 104 | :type sen3 105 | 106 | runList sen3 107 | 108 | sen4 = log someone <\> (likes john) 109 | 110 | :type sen4 111 | 112 | runList (runWriterT sen4) 113 | 114 | type Stack = List E 115 | 116 | discourseInitial :: Stack 117 | discourseInitial = [] 118 | 119 | justMentionedJohn :: Stack 120 | justMentionedJohn = [John] 121 | 122 | pro :: MonadState Stack m => m E 123 | pro = gets head 124 | 125 | sen6 = mary <\> (likes pro) 126 | 127 | runState sen6 justMentionedJohn 128 | -- justMentionedJohn = [John] 129 | 130 | runState sen6 discourseInitial 131 | -- discourseInitial = [] 132 | 133 | push :: MonadState Stack m => m E -> m E 134 | push m = m >>= \x -> state (\s -> (x, x:s)) 135 | -- = m >>= \x -> modify (x:) >>= \_ return x 136 | 137 | sen7 = push mary <\> (likes pro) 138 | 139 | :type sen7 140 | 141 | runState sen7 justMentionedJohn 142 | 143 | sen65 = mary <\> (likes log pro) 144 | 145 | :type sen65 146 | 147 | runWriter (runStateT sen65 justMentionedJohn) 148 | 149 | sen8 = push someone <\> (likes pro) 150 | 151 | :type sen8 152 | 153 | runList (runStateT sen8 discourseInitial) 154 | 155 | sen9 = push someone <\> (likes log pro) 156 | 157 | :type sen9 158 | 159 | runList (runRWST sen9 thisContext discourseInitial) 160 | 161 | sen10 :: (MonadPlus m, MonadRWS Context String Stack m) => m Bool 162 | sen10 = push someone <\> (likes log me) 163 | 164 | runList (runRWST sen10 thisContext discourseInitial) 165 | 166 | everyone :: Monad m => ContT Bool m E 167 | everyone = ContT (\k -> k John `andM` k Mary) 168 | where m `andM` n = m <\> (return (&&) n) 169 | 170 | lower :: Monad m => ContT a m a -> m a 171 | lower t = runContT t return 172 | 173 | sen11 = everyone <\> (likes mary) 174 | 175 | :type sen11 176 | 177 | runIdentity (lower sen11) 178 | 179 | sen111 = mary <\> (likes everyone) 180 | 181 | :type sen111 182 | 183 | runIdentity (lower sen111) 184 | 185 | sen12 :: MonadState Stack m => ContT Bool m Bool 186 | sen12 = push everyone <\> (likes mary) 187 | 188 | runState (lower sen12) discourseInitial 189 | 190 | sen13 :: (MonadPlus m, MonadState Stack m, MonadWriter String m) => ContT Bool m Bool 191 | sen13 = log someone <\> (likes push everyone) 192 | 193 | runList (runWriterT (runStateT (lower sen13) discourseInitial)) 194 | 195 | sen14 :: (MonadPlus m, MonadState Stack m, MonadWriter String m) => ContT Bool m Bool 196 | sen14 = push everyone <\> (likes log someone) 197 | 198 | runList (runWriterT (runStateT (lower sen14) discourseInitial)) 199 | -------------------------------------------------------------------------------- /_book/combined-effects/applicatives.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Applicatives | Monads and Natural Language Semantics 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 | 49 | 50 |
51 | 54 | 380 |
381 | 382 |
383 |
384 |
385 | 386 | 387 | 388 | 389 | 416 | 417 | 418 | 419 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 |

463 | 464 | Monads and Natural Language Semantics 465 |

466 |
467 | 468 |
469 |
470 | 471 | 472 |
473 | 474 |

Applicatives

475 |
    476 |
  • Coming soon
  • 477 |
478 | 479 | 480 |
481 | 482 | 483 |
484 |
485 |
486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 |
494 |
495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 509 | 510 | 511 | 512 | 513 | 514 | -------------------------------------------------------------------------------- /_book/combined-effects/focus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Focus | Monads and Natural Language Semantics 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 | 49 | 50 |
51 | 54 | 380 |
381 | 382 |
383 |
384 |
385 | 386 | 387 | 388 | 389 | 416 | 417 | 418 | 419 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 |

463 | 464 | Monads and Natural Language Semantics 465 |

466 |
467 | 468 |
469 |
470 | 471 | 472 |
473 | 474 |

Focus

475 |
    476 |
  • Coming soon
  • 477 |
478 | 479 | 480 |
481 | 482 | 483 |
484 |
485 |
486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 |
494 |
495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 509 | 510 | 511 | 512 | 513 | 514 | -------------------------------------------------------------------------------- /_book/combined-effects/xforms.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Transformers | Monads and Natural Language Semantics 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 | 49 | 50 |
51 | 54 | 380 |
381 | 382 |
383 |
384 |
385 | 386 | 387 | 388 | 389 | 416 | 417 | 418 | 419 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 |

463 | 464 | Monads and Natural Language Semantics 465 |

466 |
467 | 468 |
469 |
470 | 471 | 472 |
473 | 474 |

Transformers

475 |
    476 |
  • Coming soon
  • 477 |
478 | 479 | 480 |
481 | 482 | 483 |
484 |
485 |
486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 |
494 |
495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 509 | 510 | 511 | 512 | 513 | 514 | -------------------------------------------------------------------------------- /_book/continuations/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Continuations | Monads and Natural Language Semantics 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 | 49 | 50 |
51 | 54 | 380 |
381 | 382 |
383 |
384 |
385 | 386 | 387 | 388 | 389 | 416 | 417 | 418 | 419 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 |

463 | 464 | Monads and Natural Language Semantics 465 |

466 |
467 | 468 |
469 |
470 | 471 | 472 |
473 | 474 |

Continuations

475 |
    476 |
  • Coming soon
  • 477 |
478 | 479 | 480 |
481 | 482 | 483 |
484 |
485 |
486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 |
494 |
495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 509 | 510 | 511 | 512 | 513 | 514 | -------------------------------------------------------------------------------- /_book/continuations/layers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Continuations for Layered Effects | Monads and Natural Language Semantics 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | 47 | 48 |
49 | 52 | 378 |
379 | 380 |
381 |
382 |
383 | 384 | 385 | 386 | 387 | 414 | 415 | 416 | 417 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 |

461 | 462 | Monads and Natural Language Semantics 463 |

464 |
465 | 466 |
467 |
468 | 469 | 470 |
471 | 472 |

Continuations and Monads

473 |
    474 |
  • Coming soon
  • 475 |
476 | 477 | 478 |
479 | 480 | 481 |
482 |
483 |
484 | 485 | 486 | 487 | 488 | 489 |
490 |
491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 505 | 506 | 507 | 508 | 509 | 510 | -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/250.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/merriweather/250.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/250i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/merriweather/250i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/merriweather/400.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/400i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/merriweather/400i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/merriweather/700.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/700i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/merriweather/700i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/merriweather/900.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/900i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/merriweather/900i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/300.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/opensans/300.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/300i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/opensans/300i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/opensans/400.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/400i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/opensans/400i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/600.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/opensans/600.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/600i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/opensans/600i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/opensans/700.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/700i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/fonts/opensans/700i.woff -------------------------------------------------------------------------------- /_book/gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /_book/gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css: -------------------------------------------------------------------------------- 1 | .book .book-summary .chapter > .articles { 2 | overflow: hidden; 3 | max-height: 0px; 4 | } 5 | 6 | .book .book-summary .chapter.expanded > .articles { 7 | max-height: 9999px; 8 | } 9 | 10 | .book .book-summary .exc-trigger { 11 | position: absolute; 12 | left: 12px; 13 | top: 12px; 14 | } 15 | 16 | .book .book-summary ul.summary li a, 17 | .book .book-summary ul.summary li span { 18 | padding-left: 30px; 19 | } 20 | 21 | .book .book-summary .exc-trigger:before { 22 | content: "\f054"; 23 | } 24 | 25 | .book .book-summary .expanded > a .exc-trigger:before, 26 | .book .book-summary .expanded > span .exc-trigger:before { 27 | content: "\f078"; 28 | } 29 | -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jQuery'], function(gitbook, $) { 2 | var TOGGLE_CLASSNAME = 'expanded', 3 | CHAPTER = '.chapter', 4 | ARTICLES = '.articles', 5 | TRIGGER_TEMPLATE = '', 6 | LS_NAMESPACE = 'expChapters'; 7 | var init = function () { 8 | // adding the trigger element to each ARTICLES parent and binding the event 9 | $(ARTICLES) 10 | .parent(CHAPTER) 11 | .children('a') 12 | .append( 13 | $(TRIGGER_TEMPLATE) 14 | .on('click', function(e) { 15 | e.preventDefault(); 16 | e.stopPropagation(); 17 | toggle($(e.target).closest(CHAPTER)); 18 | }) 19 | ); 20 | expand(lsItem()); 21 | //expand current selected chapter with it's parents 22 | var activeChapter = $(CHAPTER + '.active'); 23 | expand(activeChapter); 24 | expand(activeChapter.parents(CHAPTER)); 25 | 26 | 27 | } 28 | var toggle = function ($chapter) { 29 | if ($chapter.hasClass('expanded')) { 30 | collapse($chapter); 31 | } else { 32 | expand($chapter); 33 | } 34 | } 35 | var collapse = function ($chapter) { 36 | if ($chapter.length && $chapter.hasClass(TOGGLE_CLASSNAME)) { 37 | $chapter.removeClass(TOGGLE_CLASSNAME); 38 | lsItem($chapter); 39 | } 40 | } 41 | var expand = function ($chapter) { 42 | if ($chapter.length && !$chapter.hasClass(TOGGLE_CLASSNAME)) { 43 | $chapter.addClass(TOGGLE_CLASSNAME); 44 | lsItem($chapter); 45 | } 46 | } 47 | var lsItem = function () { 48 | var map = JSON.parse(localStorage.getItem(LS_NAMESPACE)) || {} 49 | if (arguments.length) { 50 | var $chapters = arguments[0]; 51 | $chapters.each(function (index, element) { 52 | var level = $(this).data('level'); 53 | var value = $(this).hasClass(TOGGLE_CLASSNAME); 54 | map[level] = value; 55 | }) 56 | localStorage.setItem(LS_NAMESPACE, JSON.stringify(map)); 57 | } else { 58 | return $(CHAPTER).map(function(index, element){ 59 | if (map[$(this).data('level')]) { 60 | return this; 61 | } 62 | }) 63 | } 64 | } 65 | gitbook.events.bind('page.change', function() { 66 | init() 67 | }); 68 | }); 69 | -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_AMS-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Bold.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Caligraphic-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Bold.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Fraktur-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Bold.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Italic.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Main-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-BoldItalic.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Italic.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Math-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Bold.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Italic.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_SansSerif-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Script-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size1-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size2-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size3-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Size4-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.eot -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.ttf -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.woff -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylnb/esslli2015-monads/83939bb70d4f3ee8651ad53064e15f39e06019b3/_book/gitbook/plugins/gitbook-plugin-katex/fonts/KaTeX_Typewriter-Regular.woff2 -------------------------------------------------------------------------------- /_book/gitbook/print.css: -------------------------------------------------------------------------------- 1 | .link-inherit{color:inherit}.link-inherit:hover,.link-inherit:focus{color:inherit}.hidden{display:none}.hljs-comment,.hljs-title{color:#8e908c}.hljs-variable,.hljs-attribute,.hljs-tag,.hljs-regexp,.ruby .hljs-constant,.xml .hljs-tag .hljs-title,.xml .hljs-pi,.xml .hljs-doctype,.html .hljs-doctype,.css .hljs-id,.css .hljs-class,.css .hljs-pseudo{color:#c82829}.hljs-number,.hljs-preprocessor,.hljs-pragma,.hljs-built_in,.hljs-literal,.hljs-params,.hljs-constant{color:#f5871f}.ruby .hljs-class .hljs-title,.css .hljs-rules .hljs-attribute{color:#eab700}.hljs-string,.hljs-value,.hljs-inheritance,.hljs-header,.ruby .hljs-symbol,.xml .hljs-cdata{color:#718c00}.css .hljs-hexcolor{color:#3e999f}.hljs-function,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword,.perl .hljs-sub,.javascript .hljs-title,.coffeescript .hljs-title{color:#4271ae}.hljs-keyword,.javascript .hljs-function{color:#8959a8}.hljs{display:block;background:white;color:#4d4d4c;padding:.5em}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:.5}.page.page-toc .glossary{margin-bottom:40px}.page.page-toc .glossary h2 a,.page.page-toc .glossary h2 a:hover{color:inherit;text-decoration:none}.page.page-toc .glossary .glossary-index{list-style:none;margin:0;padding:0}.page.page-toc .glossary .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}.page .book-chapter{display:none}body .page{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;line-height:1.4;color:#333;overflow:hidden;line-height:1.6;word-wrap:break-word;display:block}body .page>*:first-child{margin-top:0!important}body .page>*:last-child{margin-bottom:0!important}body .page a{background:transparent}body .page a:active,body .page a:hover{outline:0}body .page strong{font-weight:bold}body .page h1{font-size:2em;margin:.67em 0}body .page img{border:0}body .page hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}body .page pre{overflow:auto}body .page code,body .page pre{font-family:monospace,monospace;font-size:1em}body .page table{border-collapse:collapse;border-spacing:0}body .page td,body .page th{padding:0}body .page *{-moz-box-sizing:border-box;box-sizing:border-box}body .page a{color:#4183c4;text-decoration:none}body .page a:hover,body .page a:focus,body .page a:active{text-decoration:underline}body .page hr{height:0;margin:15px 0;overflow:hidden;background:transparent;border:0;border-bottom:1px solid #ddd}body .page hr:before,body .page hr:after{display:table;content:" "}body .page hr:after{clear:both}body .page h1,body .page h2,body .page h3,body .page h4,body .page h5,body .page h6{margin-top:15px;margin-bottom:15px;line-height:1.1}body .page h1{font-size:30px}body .page h2{font-size:21px}body .page h3{font-size:16px}body .page h4{font-size:14px}body .page h5{font-size:12px}body .page h6{font-size:11px}body .page blockquote{margin:0}body .page ul,body .page ol{padding:0;margin-top:0;margin-bottom:0}body .page ol ol{list-style-type:lower-roman}body .page dd{margin-left:0}body .page code,body .page pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px}body .page pre{margin-top:0;margin-bottom:0}body .page .markdown-body>*:first-child{margin-top:0!important}body .page .markdown-body>*:last-child{margin-bottom:0!important}body .page .anchor{position:absolute;top:0;bottom:0;left:0;display:block;padding-right:6px;padding-left:30px;margin-left:-30px}body .page .anchor:focus{outline:0}body .page h1,body .page h2,body .page h3,body .page h4,body .page h5,body .page h6{position:relative;margin-top:1em;margin-bottom:16px;font-weight:bold;line-height:1.4}body .page h1{padding-bottom:.3em;font-size:2.25em;line-height:1.2;border-bottom:1px solid #eee}body .page h2{padding-bottom:.3em;font-size:1.75em;line-height:1.225;border-bottom:1px solid #eee}body .page h3{font-size:1.5em;line-height:1.43}body .page h4{font-size:1.25em}body .page h5{font-size:1em}body .page h6{font-size:1em;color:#777}body .page p,body .page blockquote,body .page ul,body .page ol,body .page dl,body .page table,body .page pre{margin-top:0;margin-bottom:16px}body .page hr{height:4px;padding:0;margin:16px 0;background-color:#e7e7e7;border:0 none}body .page ul,body .page ol{padding-left:2em}body .page ol ol,body .page ol ul,body .page ul ul{margin-top:0;margin-bottom:0}body .page dl{padding:0}body .page dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}body .page dl dd{padding:0 16px;margin-bottom:16px}body .page blockquote{padding:0 15px;color:#777;border-left:4px solid #ddd}body .page blockquote>:first-child{margin-top:0}body .page blockquote>:last-child{margin-bottom:0}body .page table{display:block;width:100%;overflow:auto}body .page table th{font-weight:bold}body .page table th,body .page table td{padding:6px 13px;border:1px solid #ddd}body .page table tr{background-color:#fff;border-top:1px solid #ccc}body .page table tr:nth-child(2n){background-color:#f8f8f8}body .page img{max-width:100%;-moz-box-sizing:border-box;box-sizing:border-box;page-break-inside:avoid}body .page code{padding:0;padding-top:.2em;padding-bottom:.2em;margin:0;font-size:85%;background-color:#f7f7f7;border-radius:3px}body .page code:before,body .page code:after{letter-spacing:-0.2em;content:"\00a0"}body .page pre>code{padding:0;margin:0;font-size:100%;white-space:pre;background:transparent;border:0}body .page .highlight pre,body .page pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f7f7f7;border:0;border-radius:3px}body .page pre{word-wrap:normal}body .page pre code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}body .page pre code:before,body .page pre code:after{content:normal}body .page .highlight{background:#fff} -------------------------------------------------------------------------------- /_book/monad-examps/haskell.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Chapter preface. 4 | 5 | When $$a \ne 0$$, there are two solutions to $$(ax^2 + bx + c = 0)$$ and they are 6 | $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ 7 | 8 | -------------------------------------------------------------------------------- /_book/monad-examps/set.md: -------------------------------------------------------------------------------- 1 | # List 2 | 3 | $$\text{Set}\, a = \{a\}$$ 4 | 5 | $$ 6 | \begin{array}{l} 7 | \eta\,x = \{x\}\\ 8 | m \star k = \{k\,x \mid x \in m\} 9 | \end{array} 10 | $$ 11 | -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["katex","expandable-chapters"], 3 | "gitbook": "2.1.0", 4 | "title": "Monads and Natural Language Semantics" 5 | } 6 | -------------------------------------------------------------------------------- /combined-effects/README.md: -------------------------------------------------------------------------------- 1 | # State and Alternatives: Dynamic Semantics 2 | 3 | * Coming soon 4 | -------------------------------------------------------------------------------- /combined-effects/applicatives.md: -------------------------------------------------------------------------------- 1 | # Applicatives 2 | 3 | * Coming soon 4 | -------------------------------------------------------------------------------- /combined-effects/dynamics.md: -------------------------------------------------------------------------------- 1 | # Alternatives + State: Dynamic Semantics 2 | 3 | * Coming soon 4 | -------------------------------------------------------------------------------- /combined-effects/focus.md: -------------------------------------------------------------------------------- 1 | # Focus 2 | 3 | * Coming soon 4 | -------------------------------------------------------------------------------- /combined-effects/xforms.md: -------------------------------------------------------------------------------- 1 | # Transformers 2 | 3 | * Coming soon 4 | -------------------------------------------------------------------------------- /continuations/README.md: -------------------------------------------------------------------------------- 1 | # Continuations 2 | 3 | * Coming soon 4 | -------------------------------------------------------------------------------- /continuations/layers.md: -------------------------------------------------------------------------------- 1 | # Continuations and Monads 2 | 3 | * Coming soon 4 | -------------------------------------------------------------------------------- /continuations/scope.md: -------------------------------------------------------------------------------- 1 | # Continuations for Scope 2 | 3 | * Coming soon 4 | -------------------------------------------------------------------------------- /gsv/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Groenendijk, Stokhof, and Veltman 1996 3 | 4 | ## Doing things with monads (an extended application): Groenendijk, Stokhof and Veltman's *Coreference and Modality* 5 | 6 | Here is the paper: [GSV](../Readings/GSV-coreference-and-modality.pdf) 7 | 8 | GSV are interested in developing and establishing a reasonable theory 9 | of discourse update. One way of looking at this paper is like this: 10 | 11 | > GSV = GS + V, where 12 | 13 | > GS = Dynamic theories of binding of Groenendijk and Stokhof, e.g., 14 | > Dynamic Predicate Logic L&P 1991: dynamic binding, donkey anaphora 15 | > Dynamic Montague Grammar 1990: generalized quantifiers and 16 | > discourse referents 17 | 18 | > V = a dynamic theory of epistemic modality, e.g., 19 | > Veltman, Frank. "Data semantics." 20 | > In Truth, Interpretation and Information, Foris, Dordrecht 21 | > (1984): 43-63, or 22 | > Veltman, Frank. "Defaults in update semantics." Journal of 23 | > philosophical logic 25.3 (1996): 221-261. 24 | 25 | That is, Groenendijk and Stokhof have a well-known theory of dynamic 26 | semantics, and Veltman has a well-known theory of epistemic modality, 27 | and this fragment brings both of those strands together into a single 28 | system. The key result, as we'll discuss, is that adding modality to 29 | dynamic semantics creates some unexpected and fascinating 30 | interactions. 31 | 32 | ## Empirical target 33 | 34 | Epistemic modality: 35 | 36 | * Alice might be hungry. Alice isn't hungry. 37 | * #Alice isn't hungry. (So) Alice might be hungry. 38 | 39 | Pronoun binding: 40 | 41 | * A man entered. He sat. 42 | * He sat. A man entered. 43 | 44 | Interaction of modality with binding: [the broken vase scenario...] 45 | 46 | 47 | ## Basics of GSV's fragment 48 | 49 | The fragment in this paper is unusually elegant. We'll present it on 50 | its own terms, with the exception that we will not use GSV's "pegs". 51 | See the discussion below below concerning pegs for an explanation. 52 | After presenting the paper, we'll re-engineer the fragment using 53 | explicit monads. So think about where you would put monadic layers. 54 | 55 | * an evaluation point, "a possibility": (world, assignment function) 56 | 57 | * "information state": set of possibilities 58 | 59 | * Combines info about the facts, info about the discourse 60 | 61 | * Predicate Calculus with equality, existential and universal 62 | quantification, and one unary modality 63 | 64 | * Terms: Alice, Bob, Carl, or a variable. 65 | 66 | * ref ((w,g), t) = t if t is Alice or Bob or Carl, and g(t) if t is a var 67 | 68 | GSV's definitions of update: 69 | 70 | * s[P(t)] = {(w,g) in s | extension w P (ref((w,g),t))} 71 | 72 | So `man(x)` is the set of live possibilities `(w,g)` in s such that 73 | the set of men in `w` given by `extension w "man"` maps the object 74 | referred to by `x`, namely, `g("x")`, to `true`. That is, update with 75 | "man(x)" discards all possibilities in which "x" fails to refer to a 76 | man. 77 | 78 | * s[t1 = t2] = {i in s | ref(i,t1) == ref(i,t2)} 79 | 80 | * s[φ and ψ] = s[φ][ψ] 81 | 82 | * s[neg φ] = {i | {i}[φ] = {}} 83 | 84 | Existential quantification is somewhat intricate. 85 | 86 | * s[∃xφ] = Union {{(w, g[x->a]) | (w,g) in s}[φ] | a in ent} 87 | 88 | Here's the recipe: 89 | 90 | * given a starting infostate s, choose an object a 91 | from the domain of discourse. 92 | 93 | * Construct a modified infostate s' by 94 | adjusting the assignment function of each possibility so as to map the 95 | variable x to a. 96 | 97 | * Then update s' with φ. 98 | 99 | * Finally, take the union over 100 | the results of doing this for every object a in the domain of 101 | discourse. 102 | 103 | And here is the definition of truth: 104 | 105 | * Truth: if updating φ with the information state that contains only 106 | the possibility i returns the empty information state, then not φ is 107 | true with respect to i. 108 | 109 | Disjunction, the conditional, and the universals are defined 110 | in terms of negation and the other connectives 111 | 112 | Exercise: assume that there are three entities in the domain of 113 | discourse, Alice, Bob, and Carl. Assume that Alice is a woman, and 114 | Bob and Carl are men. 115 | 116 | Compute the following: 117 | 118 | 1. {(w,g)}[∃x.man(x)] 119 | 120 | = {(w,g[x->a])}[man(x)] ++ {(w,g[x->b])}[man(x)] 121 | ++ {(w,g[x->c])}[man(x)] 122 | = {} ++ {(w,g[x->b])} ++ {(w,g[x->c])} 123 | = {(w,g[x->a]),(w,g[x->b]),(w,g[x->c])} 124 | -- Bob and Carl are men 125 | 126 | ## Order and modality 127 | 128 | The final remaining update rule concerns modality: 129 | 130 | * s[◊φ] = {i in s | s[φ] ≠ {}} 131 | 132 | 1. Alice isn't hungry. #Alice might be hungry. 133 | 134 | We'll start with an infostate containing two possibilities. In one 135 | possibility, Alice is hungry (call this possibility "hungry"); in the 136 | other, she is not (call it "full"). 137 | 138 | {hungry, full}[Alice isn't hungry][Alice might be hungry] 139 | = {full}[Alice might be hungry] 140 | = {} 141 | 142 | As usual in dynamic theories, a sequence of sentences is treated as if 143 | the sentence were conjoined. 144 | 145 | {full}[Alice is hungry] 146 | = {} 147 | 148 | 2. Alice might be hungry. Alice isn't hungry. 149 | 150 | We'll start with the same two possibilities. 151 | 152 | = {hungry, full}[Alice might be hungry][Alice isn't hungry] 153 | = {hungry, full}[Alice isn't hungry] 154 | = {full} 155 | 156 | GSV comment that a single speaker couldn't possibly be in a position 157 | to utter the discourse in (2). 158 | 159 | 3. (Based on public evidence,) Alice might be hungry. 160 | (But in fact I have private knowledge that) she's not hungry. 161 | 162 | The main point to appreciate here is that the update behavior of the 163 | discourses depends on the order in which the sentences are processed. 164 | 165 | You might think that asserting *might* requires that the prejacent be 166 | not merely possible, but undecided. 167 | 168 | ## Order and binding 169 | 170 | 6. A man^x entered. He_x sat. 171 | 7. He_x sat. A man^x entered. 172 | 173 | In order to demonstrate how the fragment treats these discourses, we'll 174 | need an information state whose refsys is defined for at least one 175 | variable. 176 | 177 | 8. {(w,g[x->b])} 178 | 179 | This infostate contains a refsys and an assignment that maps the 180 | variable x to Bob. Here are the facts in world w: 181 | 182 | extension w "enter" a = false 183 | extension w "enter" b = true 184 | extension w "enter" c = true 185 | 186 | extension w "sit" a = true 187 | extension w "sit" b = true 188 | extension w "sit" c = false 189 | 190 | We can now consider the discourses in (6) and (7) (after magically 191 | converting them to the Predicate Calculus): 192 | 193 | 9. Someone^x entered. He_x sat. 194 | 195 | {(w,g[x->b])}[∃x.enter(x)][sit(x)] 196 | 197 | = ( {(w,g[x->b][x->a])}[enter(x)] 198 | ++ {(w,g[x->b][x->b])}[enter(x)] 199 | ++ {(w,g[x->b][x->c])}[enter(x)])[sit(x)] 200 | 201 | -- "enter(x)" filters out the possibility in which x refers 202 | -- to Alice, since Alice didn't enter 203 | 204 | = ( {} 205 | ++ {(w,g[x->b][x->b])} 206 | ++ {(w,g[x->b][x->c])})[sit(x)] 207 | 208 | -- "sit(x)" filters out the possibility in which x refers 209 | -- to Carl, since Carl didn't sit 210 | 211 | = {(w,g[x->b][x->b])} 212 | 213 | One of the key facts here is that even though the existential has 214 | scope only over the first sentence, in effect it binds the pronoun in 215 | the following clause. This is characteristic of dynamic theories in 216 | the style of Groenendijk and Stokhof, including DPL and DMG. 217 | 218 | The outcome is different if the order of the sentences is reversed. 219 | 220 | 10. He_x sat. Someone^x entered. 221 | 222 | {(w,g[x->b])}[sit(x)][∃x.enter(x)] 223 | 224 | -- evaluating `sit(x)` rules out nothing, since (coincidentally) 225 | -- x refers to Bob, and Bob is a sitter 226 | 227 | = {(w,g[x->b])}[∃x.enter(x)] 228 | 229 | -- Just as before, the existential adds a new peg and assigns 230 | -- it to each object 231 | 232 | = {(w,g[x->b][x->a])}[enter(x)] 233 | ++ {(w,g[x->b][x->b])}[enter(x)] 234 | ++ {(w,g[x->b][x->c])}[enter(x)] 235 | 236 | -- enter(x) eliminates all those possibilities in which x did 237 | -- not enter 238 | 239 | = {} ++ {(w,g[x->b][x->b])} 240 | ++ {(w,g[x->b][x->c])} 241 | 242 | = {(w,g[x->b][x->b]), (w,g[x->b][x->c])} 243 | 244 | Before, there was only one possibility: that x refered to the only 245 | person who both entered and sat. Here, there remain two 246 | possibilities: that x refers to Bob, or that x refers to Carl. This 247 | makes predictions about the interpretation of continuations of the 248 | dialogs: 249 | 250 | 11. A man^x entered. He_x sat. He_x spoke. 251 | 12. He_x sat. A man^x entered. He_x spoke. 252 | 253 | The construal of (11) as marked entails that the person who spoke also 254 | entered and sat. The construal of (12) guarantees only that the 255 | person who spoke also entered. There is no guarantee that the person 256 | who spoke sat. 257 | 258 | 13. If a woman entered, she sat. 259 | 260 | See the paper for details. 261 | 262 | ## Interactions of binding with modality 263 | 264 | * (∃x.enter(x)) and (sit(x)) ≡ ∃x (enter(x) and sit(x)) 265 | 266 | In words, existentials can bind pronouns in subsequent clauses even if 267 | they don't take syntactic scope over those clauses. 268 | 269 | The presence of modal possibility, however, disrupts this 270 | generalization. GSV illustrate this with the following story. 271 | 272 | The Broken Vase: 273 | There are three children: Alice, Bob, and Carl. 274 | One of them broke a vase. 275 | Alice is known to be innocent. 276 | Someone is hiding in the closet. 277 | 278 | * (∃x.closet(x)) and (◊guilty(x)) ≡/≡ ∃x (closet(x) and ◊guilty(x)) 279 | 280 | To see this, we'll start with the left hand side. We'll need at least 281 | two worlds. 282 | 283 | in closet guilty 284 | --------------- --------------- 285 | w: a true a false 286 | b false b true 287 | c false c false 288 | 289 | w': a false a false 290 | b false b false 291 | c true c true 292 | 293 | GSV say that (∃x.closet(x)) and (◊guilty(x)) is true if there is at 294 | least one possibility in which a person in the closet is guilty. In 295 | this scenario, world w' is the verifying world: Carl is in the closet, 296 | and he's guilty. It remains possible that there are closet hiders who 297 | are not guilty in any world. Alice fits this bill: she's in the 298 | closet in world w, but she is not guilty in any world. 299 | 300 | Let's see how this works out in detail. 301 | 302 | 14. Someone^x is in the closet. They_x might be guilty. 303 | 304 | {(w,g), (w',g}[∃x.closet(x)][◊guilty(x)] 305 | 306 | -- existential introduces new peg 307 | 308 | = ( {(w,g[x->a]), (w',g[x->a])}[closet(x)] 309 | ++ {(w,g[x->b]), (w',g[x->b])}[closet(x)] 310 | ++ {(w,g[x->c]), (w',g[x->c])}[closet(x)] 311 | )[◊guilty(x)] 312 | 313 | -- only possibilities in which x is in the closet survive 314 | -- the first update 315 | 316 | = {(w,g[x->a]), (w',g[x->c])}[◊guilty(x)] 317 | 318 | -- Is there any possibility in which x is guilty? 319 | -- yes: for x = Carl, in world w' Carl broke the vase 320 | -- that's enough for the possiblity modal to allow the entire 321 | -- infostate to pass through unmodified. 322 | 323 | = {(w,g[x->a]),(w',g[x->c])} 324 | 325 | Now we consider the second half: 326 | 327 | 15. Someone^x is in the closet who_x might be guilty. 328 | 329 | {(w,g), (w',g)}[∃x(closet(x) & ◊guilty(x))] 330 | 331 | = {(w,g[x->a]), (w',g[x->a])}[closet(x)][◊guilty(x)] 332 | ++ {(w,g[x->b]), (w',g[x->b])}[closet(x)][◊guilty(x)] 333 | ++ {(w,g[x->c]), (w',g[x->c])}[closet(x)][◊guilty(x)] 334 | 335 | -- filter out possibilities in which x is not in the closet 336 | -- and filter out possibilities in which x is not guilty 337 | -- the only person who was guilty in the closet was Carl in 338 | -- world w' 339 | 340 | = {(w',g[x->c])} 341 | 342 | The result is different. Fewer possibilities remain. We have 343 | eliminated one of the possible worlds (w is ruled out), and we have 344 | eliminated one of the possible discourses (x cannot refer to Alice). 345 | So the second formula is more informative. 346 | 347 | One of main conclusions of GSV is that in the presence of modality, 348 | the hallmark of dynamic treatments--that existentials bind outside of 349 | their syntactic scope--needs to refined into a more nuanced understanding. 350 | Binding still occurs, but the extent of the syntactic scope of an existential 351 | has a detectable effect on truth conditions. 352 | -------------------------------------------------------------------------------- /gsv/gsv-monad.md: -------------------------------------------------------------------------------- 1 | 2 | # GSV Monadized 3 | 4 | * There are a few ways to go here. In class we presented the following 5 | fragment 6 | 7 | * `[Pt] = λg.{(w,g) | [P](g(t))(w)}` 8 | * `[∃x.φ] = λg.U{[φ](g[x->v]) | v in D_e}` 9 | * `[◊φ] = λg.` **if** `[φ](g) ≠ ∅` **then** `{(w,g) | w in W}` **else** ∅ 10 | * `[α ; β] = [α] >>= \w.[β] >>= \w'.` **if** `w == w'` **then** `return w` **else** `λg.∅` 11 | 12 | * This uses the same state+set monad we introduced for plain extensional 13 | dynamic semantics. Binding information is transmitted in the usual fashion, 14 | through the input and output assignment functions, where it accumulates 15 | according the order in which clauses are evaluated. 16 | 17 | * But the nondeterminism now does double duty. As before, in the presence of an 18 | existential, the computation branches into a set of outputs, each of which 19 | will push through whatever comes next independently. But it also encodes 20 | uncertainty about the world of evaluation. For instance, atomic sentences 21 | denote the update that returns every world at which the predicate holds of 22 | its argument *in a different branch*. Effectively, it treats clauses as 23 | indefinites over worlds: `[Pt] ≈ "some world in which P(t)"`. 24 | 25 | * Conjunction encodes an order-sensitive version of set intersection. Any 26 | binding side effects from the first conjunct are allowed to influence the 27 | second, and any additional effects in the second survive to influence 28 | whatever comes next. 29 | 30 | 31 | --- 32 | 33 | 34 | * However, as pointed out in class, while this formulation does capture the way 35 | that existentials can bind pronouns beyond their local scope, it doesn't 36 | quite capture the modal dynamicity at the heart of the V part of GSV. 37 | 38 | * You can see that the entry for `◊φ` has no access to the modal state of play 39 | prior to its evaluation. The only thing it reads in is `g`, the current, 40 | local state of how discourse referents are allocated to variables. So there 41 | will be no way for previous information about what the set of current 42 | *possibilities* is like to influence the denotation of `◊φ`. In particular, 43 | "Alice isn't hungry; she might be hungry" will be felicitous just in case 44 | right now, Alice both might be hungry and isn't hungry. The second conjunct 45 | doesn't take into account the information contributed by the first. 46 | 47 | 48 | --- 49 | 50 | 51 | * The problem is exactly the way that modal possibilities are conflated with 52 | binding possibilities. In effect we've sublimated the "information" in each 53 | clause into the nondynamic side effects of its denotation. But that's a 54 | mistake; information-accrual is certainly dynamic, and moreover probably not 55 | a side effect. 56 | 57 | * This suggests the following revision 58 | 59 | * `[Pt] = λpλg.{(p ∩ q, g) | q = {w | [P](g(t))(w)}}` 60 | 61 | * `[∃x.φ] = λpλg.U{(p ∩ q, g') | v in D_e, (q,g') in [φ](g[x->v])}` 62 | 63 | * `[◊φ] = λpλg.` **if** `∃(q,g') in [φ](g)(p). q ≠ ∅` **then** `{(p,g)}` **else** `∅` 64 | 65 | * `[α ; β] = α >=> β` (see below for `>=>`) 66 | 67 | * Now our three types of clauses are all functions from plain propositions to 68 | propositions in the dynamic monad:: `st -> M (st)`, where `M` is our 69 | state+set contraption:: `M a = g -> {(a,g)}` (pardon the reuse of `g` as the 70 | *type* of assignment functions) 71 | 72 | * The first two clauses take the incoming proposition and intersect it with 73 | their own (this can actually be factored out into a `map2 (∩)` operation 74 | applied to something more like their essential contribution). In the case of 75 | the existential, its own information contribution is split out into a 76 | different proposition for each potential value of `x`. 77 | 78 | * The modal, however, tests its prejacent against its incoming proposition. If 79 | the prejacent and the input are not incompatible, it simple returns the input 80 | proposition (and binding state) 81 | 82 | * Conjunction is a little interesting. All of our clauses have type `a -> 83 | M a`, where `a` is `st` and `M` is the state+set monad constructor. So 84 | they're all *Kliesli arrows* ([first class](../intro/types.md)), or 85 | continuations if you prefer, or the sort of thing that comes on the right 86 | hand side of `>>=`. Now, this is neat. There is a natural notion of 87 | *composition* for these effectful continuations: `k >=> h = λp. k(p) >>= h`. 88 | That is, given a function `a -> M b` and a function `b -> M c`, we can form 89 | the composition of type `a -> M c` that, when given an argument of type `a`, 90 | essentially runs the two computations in sequence, passing the results of the 91 | first into the second. This is exactly what we want conjunction to do. 92 | 93 | * It's fitting that conjunction should be effect-respecting function 94 | composition, given that conjunction in GSV (and most dynamic systems) is 95 | (effectless) relation composition. It's also perhaps worth pointing out that 96 | this isn't the only dynamic fragment that uses a version of `>=>` for 97 | conjunction. Philippe de Groote's 2006 semantics, in a very different type 98 | system, actually proposes the Kliesli compositor (`>=>`) of the continuation 99 | monad as a way to join dynamic sentences together (though he doesn't mention 100 | it). 101 | -------------------------------------------------------------------------------- /intro/README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | ## Chris Barker (chris.barker@nyu.edu) 4 | ## Dylan Bumford (dbumford@gmail.edu) 5 | ## This course [https://github.com/dylnb/esslli2015-monads](https://github.com/dylnb/esslli2015-monads) 6 | 7 | --- 8 | 9 | * Monads are a technique from functional programming for articulating 10 | computations into layers 11 | 12 | [This discussion inspired by Wadler's "Monads for functional programming".](../Readings/wadler-monads.pdf) 13 | 14 | * For instance, imagine you are building a calculator program that 15 | evaluates artithmetic expressions. You write code that performs 16 | addition, subtraction, multiplication, and division, so that you can 17 | evaluate expressions such as `1 * ((4 / 2) + 3)`. Once that 18 | works, you decide to add the following features: 19 | 20 | --- 21 | 22 | ## Graceful failure 23 | 24 | * You decide you want to fail gracefully when there is division by 25 | zero. 26 | 27 | `1 * ((4 / 0) + 3)` 28 | 29 | The obvious strategy: modify all of the code written so far 30 | in order to handle an error condition. This is unsatisfying, since 31 | there is no reason why the code for addition ought to worry about 32 | division by zero. 33 | 34 | --- 35 | 36 | ## Variable binding 37 | 38 | * You decide to add a `let` construction, e.g., 39 | 40 | `let x = 2 in 1 * ((4 / x) + 3)` 41 | 42 | But this requires rewriting all the code again in order to deal with 43 | assigning values to variables. 44 | 45 | --- 46 | 47 | ## Meta computation 48 | 49 | * You decide to count the number of arithmetic operations performed 50 | for billing purposes. But this requires rewriting all of the basic 51 | operations yet again. 52 | 53 | --- 54 | 55 | ## Or you could use monads 56 | 57 | Monads allow adding independent layers to the computation. The basic 58 | computation performs the nested arithmetic operations. On top of 59 | that, there is a layer tracking whether division by zero has been 60 | attempted. Independently, there is a layer tracking the values of 61 | variables. Finally, there can be a layer tracking metainformation 62 | about the ongoing computation. Using monadic techniques, the orginal 63 | arithmetic computations can be used without modification. 64 | 65 | ## The connection with natural language 66 | 67 | The main idea of this course was richly anticipated by 68 | 69 | [Ken Shan's 2002 Amsterdam Colloqium Paper](../Readings/shan-monads.pdf) 70 | 71 | ***The basic idea***: 72 | Evaluating expressions is essentially what a formal grammar for a 73 | natural language does. Instead of `(* 1 (+ (/ 4 2) 3))`, we might 74 | have `((the man)(fed (his mongoose)))`. Each of the computational 75 | features imagined above have fairly close analogs in the study of 76 | natural language. 77 | 78 | * Presupposition as throwing an error: many expressions require some 79 | precondition to be met in order to have a well-defined meaning. For 80 | instance, possessives such as `his mongoose` presuppose that the 81 | person referred to owns a mongoose. If this precondition is not 82 | met, the larger expression fails to have a well-defined meaning, 83 | just as if we had tried to divide a number by zero. 84 | 85 | * Pronouns in natural language function in many (though not in all) 86 | ways like variables in a programming language. So evaluating 87 | expressions in English require a method for mapping pronouns like 88 | `his` to referents. 89 | 90 | * There are a variety of expressions in natural language that produce 91 | side effects independent of the main "computation". Expressives 92 | such as *damn*, as in *the man fed his damn mongoose*, commit the 93 | speaker to certain attitudes independently of the truth of the 94 | statement in which it occurs. 95 | 96 | [See Asudeh and Giorgolo's 2015 ESSLLI course (second week)!] 97 | (http://parles.upf.edu/llocs/esslli/content/natural-language-semantics-enriched-meanings) 98 | 99 | 100 | So the modular techniques developed for functional programming can be 101 | applied directly to many familiar problems in the interpretation of 102 | natural language. 103 | 104 | --- 105 | ### Side effects in natural language 106 | 107 | * Exactly two of the three frogs are in the pond. 108 | * It is in the tree. 109 | 110 | --- 111 | 112 | * Exactly two of the three frogs are in the pond. 113 | * So exactly one of the three frogs is not in the pond. 114 | * It is in the tree. 115 | 116 | Side effect: setting up a discourse referent. 117 | 118 | --- 119 | 120 | Although there is no limit to the variety of monads, several specific 121 | monads have proven to be useful, and have names: 122 | 123 | * Maybe monad (Option monad in O'Caml) 124 | * Reader monad 125 | * State monad 126 | * Writer monad 127 | * List monad 128 | * Continuation monad 129 | 130 | Here are some of the specific natural language phenomena for which 131 | monadic treatments have been proposed: 132 | 133 | * Intensionality (Shan 2002, Ben-avi and Winter 2009) [Reader monad]: 134 | adding a layer in which the values of expressions can depend on the 135 | choice of an evaluation parameter (usually, a possible world, or a 136 | world and a time) 137 | 138 | * Indexicality [Reader monad] 139 | 140 | * Binding (Jacobson 1999, Shan 2002, de Groote 2007) [Reader monad, 141 | State monad]: adding a layer in which the values of expressions can 142 | both depend on previous expressions, and determine subsequent 143 | expressions. 144 | 145 | * Presupposition failure [Maybe monad] 146 | * Kaplan 147 | 148 | * Expressives [Writer monad] 149 | 150 | * Scope-taking (Barker 2002, Barker and Shan 2014) [Continuation monad] 151 | 152 | In addition to all of these considerations, another important aspect 153 | of monads is that they allow fine-grained control over the order of 154 | evaluation of expressions. This has implications in the study of 155 | natural language for theories of weak crossover, negative polarity 156 | licensing, and more. 157 | 158 | [Simon Charlow's 2014 dissertation](http://semanticsarchive.net/Archive/2JmMWRjY/charlow-semantics-exceptional-scope-diss.pdf) 159 | 160 | which integrates a number of monads into a sophisticated 161 | medium-coverage grammar will be discussed in some detail in the course 162 | on Thursday. 163 | 164 | * Focus 165 | * Rooth 1985 166 | * [Bekki and Asai](../Readings/bekki-asai-covert-movement.pdf) 167 | * Charlow's dissertation (see above) 168 | * Youyou Cong's recent work 169 | -------------------------------------------------------------------------------- /intro/types.md: -------------------------------------------------------------------------------- 1 | # Basic Types 2 | 3 | * Char, Int, Bool, ... 4 | * Tuples 5 | 6 | ```haskell 7 | pos3, neg3 :: (Int, Bool) 8 | pos3 = (3, True) 9 | neg3 = (3, False) 10 | ``` 11 | 12 | * Functions 13 | 14 | ```haskell 15 | plus3 :: Int -> Int 16 | plus3 x = 3 + x 17 | ``` 18 | 19 | 20 | --- 21 | 22 | 23 | # Algebraic Types 24 | 25 | * Product Types 26 | 27 | ```haskell 28 | data Trace = Trace {var :: Char, tag :: Int} 29 | 30 | newtrace :: Trace 31 | newtrace = Trace 't' 1 32 | 33 | trace2 :: Trace 34 | trace2 = Trace {var = 't', tag = 4} 35 | ``` 36 | 37 | * Sum Types 38 | 39 | ```haskell 40 | data NP = Trace | Name String 41 | 42 | john :: NP 43 | john = Name "John" 44 | 45 | x :: NP 46 | x = trace2 47 | ``` 48 | 49 | --- 50 | 51 | 52 | # Parameterized Types 53 | 54 | * **Data constructors** like `Name` convert values from one type to another, in 55 | this case strings to NPs. They are functions that take values and return 56 | values 57 | 58 | ``` 59 | > :t Name 60 | > Name :: String -> NP 61 | ``` 62 | 63 | * Similarly, **type constructors** convert types to new types. They are 64 | functions that take *types* and return *types* 65 | 66 | ```haskell 67 | data List a = Empty | Cons a (List a) 68 | 69 | domain :: List Entity 70 | domain = Cons John (Cons Mary Nil) 71 | 72 | -- domain :: [Entity] 73 | -- domain = [John, Mary] 74 | 75 | data Pair a = Pair (a, a) 76 | 77 | theSmiths :: Pair Entity 78 | theSmiths = Pair (John, Mary) 79 | 80 | point :: Pair Int 81 | point = Pair (3, 4) 82 | ``` 83 | 84 | --- 85 | 86 | 87 | # Natural (Type) Classes 88 | 89 | * Many types represent data that are displayable. For this, we have a single 90 | `show` function, which we define for each displayable type, including our 91 | *ad-hoc* `NP` type. 92 | 93 | ```haskell 94 | instance Show NP where 95 | show (Trace v n) = "Var: " + show v + show n 96 | show (Name s) = "Name: " + s 97 | ``` 98 | 99 | * Likewise, many types of things can be tested for equality. But for parametric 100 | types, it may depend on whether the type parameter itself is defined for such 101 | a test. 102 | 103 | ```haskell 104 | instance Eq a => Eq (List a) where 105 | Nil == Nil = True 106 | (Cons x xs) == (Cons y ys) = x == y && xs == ys 107 | _ == _ = False 108 | ``` 109 | 110 | 111 | --- 112 | 113 | 114 | # *Ad hoc* Polymorphism 115 | 116 | * The `show` and `(==)` functions are *overloaded* to work on many different 117 | types, and what they do with each type is your prerogative. 118 | 119 | * This makes sense for `show`, but you might expect `(==)` to be somewhat more 120 | restricted. For instance, this definition doesn't match anybody's 121 | expectations about what an equality test should do. 122 | 123 | ```haskell 124 | instance Eq NP where 125 | _ == _ = False 126 | ``` 127 | 128 | * For things like equality, we say that any specification of the `(==)` 129 | relation for some particular type should satisfy a few well-known conditions. 130 | * reflexivity: $$\forall a.\ a = a$$ 131 | * symmetry: $$\forall a,b.\ a = b \Rightarrow b = a$$ 132 | * transitivity: $$\forall a,b,c.\ a = b \wedge b = c \Rightarrow a = c$$ 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | --- 141 | 142 | 143 | # Functors 144 | 145 | * Like equality, there are other polymorphic functions that are expected to 146 | behave according to particular *laws*. 147 | 148 | ```haskell 149 | class Functor m where 150 | fmap :: (a -> b) -> m a -> m b 151 | -- note that a and b can be any types whatsoever here; this tells you that 152 | -- being "mappable" is a property of the type constructor, regardless of what 153 | -- sorts of values it contains 154 | 155 | instance Functor List where 156 | fmap _ Nil = Nil 157 | fmap f (Cons x xs) = Cons (f x) (fmap f xs) 158 | 159 | instance Functor Pair where 160 | fmap (Pair (x, y)) = Pair (f x, f y) 161 | ``` 162 | 163 | * Any specialization of the mapping function `fmap` for a custom type `M` 164 | should satisfy: 165 | * `fmap id m` is equivalent to `m`, for any `m :: M` 166 | * `fmap (g ○ h) m` is equivalent to `fmap g (fmap h m)` , for any `m :: M` 167 | 168 | * When it does, we call `M` a **functor** under its definition of `fmap` 169 | 170 | 171 | --- 172 | 173 | 174 | # Bind 175 | 176 | * Another commonly overloaded function is a close cousin of `fmap` called 177 | *bind*, spelled `(>>=)`. 178 | 179 | * Where different definitions of `fmap` specify how to map a simple `a -> b` 180 | function over some structure full of `a`s (to end up with a structure full of 181 | `b`s), definitions of `bind` specify how to map an *structure-generating 182 | function* of type `a -> m b` over a structure full of `a`s (to end up with a 183 | structure full of `b`s. 184 | 185 | ```haskell 186 | class Functor m where 187 | fmap :: (a -> b) -> m a -> m b 188 | 189 | class Bind m where 190 | bind :: (a -> m b) -> m a -> m b 191 | 192 | instance Bind (List a) where 193 | bind f Nil = Nil 194 | bind f (Cons x xs) = concat $ Cons (f x) (bind f xs) 195 | 196 | instance Bind (Pair a) where 197 | bind f (Pair (x,y)) = Pair (fst (f x), snd (f y)) 198 | ``` 199 | 200 | 201 | --- 202 | 203 | 204 | # Monads 205 | 206 | * These structure-generating `a -> m b` functions are called **Kliesli 207 | arrows**. 208 | 209 | * Any type for which there is also a special "trivial" Kliesli arrow is 210 | called a **monad**. 211 | 212 | ```haskell 213 | class Bind m => Monad m where 214 | return :: a -> m a 215 | (>>=) :: m a -> (a -> m b) -> m b 216 | (>>=) = flip bind 217 | 218 | instance Monad List where 219 | return x = Cons x Nil 220 | 221 | instance Monad Pair where 222 | return x = Pair (x, x) 223 | ``` 224 | 225 | 226 | --- 227 | 228 | 229 | # Monad Laws 230 | 231 | * But as with `(==)` and `fmap`, these definitions of `bind` and `return` are 232 | expected to satisfy certain laws 233 | * left identity: `return x >>= f` is equivalent to `f x` 234 | * right identity: `m >>= return` is equivalent to `m` 235 | * associativity: `(m >>= f) >>= g` is equivalent to `m >>= (\x -> f x >>= g)` 236 | 237 | * Loosely speaking, the left identity law guarantees that definitions of 238 | `return` don't have any side effects. 239 | 240 | * The right identity law guarantees that definitions of `return` don't consume 241 | or modify any side effects. 242 | 243 | * The associativity law says that chains of effects should be *linear* 244 | 245 | * And that's it. A monad is a singly-parameterized type constructor together 246 | with a mapping function called **bind** and an injection function 247 | called **unit** that satisfy the monad laws. 248 | -------------------------------------------------------------------------------- /monad-examps/#trash.txt#: -------------------------------------------------------------------------------- 1 | match (x, w) with ('c', 2) -> false | _ -> true;; 2 | -------------------------------------------------------------------------------- /monad-examps/.#trash.txt: -------------------------------------------------------------------------------- 1 | barker@localhost.3694:1437935938 -------------------------------------------------------------------------------- /monad-examps/README.md: -------------------------------------------------------------------------------- 1 | # The Whirlwind Monad Tour 2 | 3 | * There are plenty of phenomena in natural language that correspond to what 4 | programmers call **side-effects** [Shan2001](../Readings/shan-monads.pdf) 5 | 6 | * Today we'll walk through a handful of examples, to get a sense of the breadth 7 | of the approach and the general pattern 8 | * Writer monad for denotations with secondary content 9 | * Reader monad for context-sensitive denotations 10 | * List/Set monad for constituents with indeterminate denotations 11 | * State monad for binding 12 | 13 | * We'll also try to do some demos at the ghc interpreter to convince those to 14 | you who don't know already what a nice research tool a functional programming 15 | language can be for natural language semantics 16 | 17 | 18 | --- 19 | 20 | 21 | # Setting the Stage 22 | 23 | * Recall the combinatorial strategy from the maybe monad example 24 | 25 | ```haskell 26 | map2 :: (a -> b -> c) -> Maybe a -> Mabye b -> Maybe c 27 | map2 m n = m >>= \x -> n >>= \y -> return (f x y) 28 | ``` 29 | 30 | * This combinator maps a *pure* function over some potentially effectful 31 | arguments 32 | 33 | 34 | --- 35 | 36 | 37 | * First, notice that there's nothing about this combinator that depends on the 38 | maybe monad; it is more generally typed 39 | 40 | ```haskell 41 | map2 :: Monad m => (a -> b -> c) -> m a -> m b -> m c 42 | ``` 43 | 44 | 45 | --- 46 | 47 | 48 | * Second, as a special case of this operation, we might want to map function 49 | application itself over two arguments: the first a monadic function, the 50 | second a monadic argument 51 | 52 | ```haskell 53 | () :: Monad m => m (a -> b) -> m a -> m b 54 | () = map2 (\f x -> f x) 55 | -- ~~> m n = m >>= \f -> n >>= \x -> return (f x) 56 | ``` 57 | 58 | * And backwards 59 | 60 | ```haskell 61 | (<\>) :: Monad m => m a -> m (a -> b) -> m b 62 | (<\>) = map2 (\x f -> f x) 63 | -- ~~> m n = m >>= \x -> n >>= \f -> return (f x) 64 | ``` 65 | 66 | 67 | --- 68 | 69 | 70 | * So `()` and `(<\>)` give effect-sensitive analogs of the traditional 71 | categorial forward and backward function application combinators 72 | 73 | * And they're monad-neutral! This makes the grammar flexible and modular: any 74 | effect for which $$\eta$$ and $$\star$$ are defined can be combined using these 75 | applicative operations 76 | -------------------------------------------------------------------------------- /monad-examps/day2-cb.md: -------------------------------------------------------------------------------- 1 | # Day 2: Examples of monads 2 | 3 | ## Last time: 4 | 5 | Every time you want to add a new side effect to your computation, 6 | you could modify each operations in order to handle the new side 7 | effect... 8 | 9 | ... or you could use a monad. 10 | 11 | ## First monad: Maybe monad 12 | 13 | If `a` is a type, then `Maybe a` is the type `Just a | Nothing` 14 | 15 | So if `a` is `Int`, then `Nothing` has type `Maybe Int`. 16 | 17 | So if `a` is `Bool`, then `Just True` has type `Maybe Bool`. 18 | 19 | So `Maybe` is a ***type function*** (pronounced in Haskell as "type constructor"): for any type `a`, `Maybe a` returns a 20 | type (based on `a`). 21 | 22 | return :: a -> Maybe a 23 | return x = Just x 24 | 25 | bind :: (Maybe a) -> (a -> Maybe b) -> (Maybe b) 26 | bind m k = if m == Nothing, Nothing 27 | if m == Just x, k x 28 | 29 | We'll write `bind m k` as `m >>= k` 30 | 31 | 32 | ## Who says it's a monad? 33 | 34 | Law 1: return x >>= k == k x 35 | Law 2: m >>= return == m 36 | 37 | case 1: m is Nothing, then m >>= return == Nothing 38 | case 2: m is Just x, then m >>= return == return x == Just x 39 | 40 | Law 3: (m >>= f) >>= g == m >>= (\x. f x >>= g) 41 | 42 | case 1: m or f or g is Nothing: both sides evalute to Nothing 43 | case 2: m is Just x: (m >>= f) >>= g == f x >>= g == g x 44 | m >>= (\x. f x >>= g) == f x >>= g == g x 45 | 46 | Yes, it's a monad! 47 | 48 | 49 | [Kaplan on plexy](../Readings/kaplan-plexy.pdf) 50 | 51 | [draw tree with plumbing] 52 | 53 | --- 54 | 55 | Gilad Ben-Avi and Yoad Winter. 2007. 56 | The Semantics of Intensionalization. 57 | Workshop on New Directions in Type-theoretic 58 | Grammars. Muskens (ed). ESSLLI (Dublin) 59 | 60 | In this paper, expressions like the verbs *seek*, *need* and 61 | *believe* and the adjective *fake*, which create an intensional 62 | context are called *intension-sensitive*. Expressions that do not 63 | create an intensional context, such as the verb kiss or the 64 | adjective red, are called *intension-insensitive*. We assume that an 65 | extensional semantics is sufficiently adequate for expressions that 66 | consist solely of intension-insensitive lexical items, while an 67 | intensional semantics is only needed for expressions with 68 | intension-sensitive lexical items. 69 | 70 | In this paper we propose a modular approach to the architecture of 71 | intensional systems that is based on this assumption. We start out 72 | by introducing a simple grammatical framework with a standard 73 | extensional semantics, and then add intension-sensitive words to the 74 | lexicon. Since the intension-sensitive lexical items (semantically) 75 | select intensional objects, the extensional types and meanings of 76 | the intension-insensitive lexical items need to be shifted to inten- 77 | sional types and meanings. 78 | 79 | --- 80 | 81 | ## Toy fragment 82 | 83 | ```haskell 84 | Reader a ==> s -> a 85 | return x = \w.x 86 | m >>= k = \w.k(m w)w 87 | 88 | -- Types: World, Ent, and Bool 89 | 90 | w1, w2 :: World 91 | Ann, Bill, Carl :: Ent 92 | 93 | president :: World -> Ent 94 | president w1 = Obama 95 | president w2 = Bush 96 | 97 | hit :: Ent -> Ent -> Bool 98 | (map2 hit) (return Ann) (return Obama) w1 == True 99 | (map2 hit) (return Ann) president w1 == True 100 | (map2 hit) (return Ann) president w2 == False 101 | 102 | seek :: Ent -> (World -> Ent) -> Bool 103 | seek Ann president == False 104 | seek Ann (return Obama) == True 105 | ``` 106 | -------------------------------------------------------------------------------- /monad-examps/haskell.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Chapter preface. 4 | 5 | When $$a \ne 0$$, there are two solutions to $$(ax^2 + bx + c = 0)$$ and they are 6 | $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ 7 | 8 | -------------------------------------------------------------------------------- /monad-examps/maybe.md: -------------------------------------------------------------------------------- 1 | 2 | # The Maybe Monad: Presupposition and its Failures 3 | 4 | * As a first example of a monad in action, we'll need a simple language that we 5 | need to evaluate. We'll start with arithmetic, but move quickly to natural 6 | language. 7 | 8 | $$7 = 7$$ 9 | 10 | $$2 + 3 = 5$$ 11 | 12 | $$8 / (3 - 1) = 4$$ 13 | 14 | * We want these sentences to evaluate to the boolean True. 15 | 16 | 17 | --- 18 | 19 | 20 | # Basic Arithmetic 21 | 22 | * Start with the usual operations with their usual semantics 23 | 24 | $$(+),\ (-),\ (\times) :: \text{Int} \to \text{Int} \to \text{Int}$$ 25 | 26 | $$(=) :: \text{Int} \to \text{Int} \to \text{Bool}$$ 27 | 28 | 29 | --- 30 | 31 | 32 | # Unsafe Division 33 | 34 | * But what about 35 | 36 | $$8 / (3 - 3) = 4$$ 37 | 38 | * In order to evaluate this sentence, we need to divide 8 by 0, which is 39 | undefined. So we need for our division operator to return either a number, 40 | or some object representing that an error has occurred. 41 | 42 | $$ 43 | x / y = 44 | \begin{cases} 45 | \iota z.\, z \times y = x \quad & \text{if } y \neq 0\\ 46 | \# & \text{otherwise} 47 | \end{cases} 48 | $$ 49 | 50 | 51 | --- 52 | 53 | 54 | # Unsafe Division (Cont'd) 55 | 56 | * But since the result of a division can itself serve as the input to other 57 | arithmetic operations, as in `4 + (8 / 2)`, we also need to adjust the 58 | meanings of addition and all of the other arithmetic functions in order to 59 | prepare them for the possibility that the result of some division somewhere 60 | might be undefined. 61 | 62 | * This is unfair --- addition is not part of the problem, yet 63 | must go out of its normal path in order to contribute to a solution. 64 | 65 | * We want a more general solution, one that allows information about the 66 | presence of an error state to propagate throughout the computation without 67 | having to adjust the internal workings of operators that don't create error 68 | conditions. 69 | 70 | 71 | 72 | --- 73 | 74 | 75 | # Introducing the Maybe Monad 76 | 77 | * We'll do this with the following monad, which we'll call the Maybe monad: 78 | 79 | $$\text{Maybe}\, a = \text{Just}\, a \mid \text{Nothing}$$ 80 | 81 | $$\eta\, x = \text{Just}\,x$$ 82 | 83 | $$ 84 | m \star k = 85 | \begin{cases} 86 | \text{Nothing} \quad & \text{if } m = \text{Nothing}\\ 87 | k\,x & \text{if } m = \text{Just}\,x 88 | \end{cases} 89 | $$ 90 | 91 | --- 92 | 93 | 94 | # Using the Monad 95 | 96 | * Our division operator will need to be ready for division by zero. 97 | 98 | $$ 99 | \text{safe/} :: \text{Maybe Int} \to \text{Maybe Int} \to \text{Maybe Int} 100 | $$ 101 | 102 | $$ 103 | \text{safe/}\,m\,n = 104 | m \star \lambda x.\, n \star \lambda y.\, 105 | \begin{cases} 106 | \text{Nothing} \quad & \text{if } x = 0\\ 107 | \text{Just}\,y/x & \text{otherwise} 108 | \end{cases} 109 | $$ 110 | 111 | --- 112 | 113 | 114 | # Generalizing This Combinatorial Strategy 115 | 116 | * For the other operators, we write a general lifting function that lifts the 117 | operators into the monadic computation. 118 | 119 | $$ 120 | \text{map2} :: 121 | (a \to b \to c) \to \text{Maybe}\,a \to \text{Maybe}\,b \to \text{Maybe}\,c 122 | $$ 123 | 124 | $$ 125 | \text{map2}\,f\,u\,v = 126 | u \star \lambda x.\, v \star \lambda y.\, \eta\,(f\,x\,y) 127 | $$ 128 | 129 | 130 | --- 131 | 132 | 133 | # Building a Sentence 134 | 135 | * Now we can compose our safe-division computation as 136 | 137 | +----------------------------------+ 138 | | | 139 | | | 140 | +-------+---------+ +--------+---------+ 141 | | | | | 142 | | | | | 143 | η 2 +-----+------+ map2 (=) η 5 144 | | | 145 | | | 146 | map2 (+) η 3 147 | 148 | 149 | * Smoothly evaluates to `Just True` 150 | 151 | 152 | --- 153 | 154 | 155 | # Putting the Monad to Work 156 | 157 | * Let's see what happens when we try division by zero: 158 | 159 | ```haskell 160 | (unit 4) (map2 +) ((unit 8) safe/ (unit 0)) (map2 =) (unit 3) 161 | 162 | (unit 8) safe/ (unit 0) 163 | ~~> (Just 8) safe/ (Just 0) 164 | ~~> Nothing 165 | 166 | (unit 4) (map2 +) ((unit 8) safe/ (unit 0)) (map2 =) (unit 3) 167 | ~~> (Just 4) (map2 +) ((unit 8) safe/ (unit 0)) (map2 =) (unit 3) 168 | ~~> (Just 4) >>= (\x. ((unit 8) safe/ (unit 0)) >>= (\y. unit (+ x y))) 169 | ~~> ((unit 8) safe/ (unit 0)) >>= (\y. unit (+ 4 y))) 170 | ~~> Nothing >>= (\y. unit (+ 4 y)) 171 | ~~> Nothing 172 | ``` 173 | 174 | [Draw tree diagram with plumbing around the edge] 175 | 176 | --- 177 | 178 | # A natural language application of the Maybe monad 179 | 180 | Finding a application for the Maybe monad in natural language is not 181 | hard. 182 | 183 | * We already have expressions and sentences. Instead of 184 | 185 | $$2 + 3 = 5$$ 186 | 187 | We want 188 | 189 | Ann and Bill saw Carl. 190 | 191 | * All we need is the lingusitic equivalent of division by zero. 192 | 193 | --- 194 | 195 | # Presuppositions 196 | 197 | * The King of France is bald. [There is no King of France.] 198 | * Ann's meerkat is sick. [Not everyone owns a meerkat.] 199 | * Ann finally realized that the world is round. 200 | * etc. 201 | 202 | * For now, assume that DPs denote (refer to) objects. 203 | 204 | * Computing reference is itself compositional, but assume we have a 205 | black box named R. 206 | 207 | * R("Ann") = ann 208 | * R("The President of the US") = obama 209 | * R("The King of France") = ____? 210 | 211 | [Kaplan on plexy](../Readings/kaplan-plexy.pdf) 212 | 213 | --- 214 | 215 | # Let R map DPs not to objects of type Ent, but to Maybe Ent: 216 | 217 | * R("Ann") = unit ann = Just ann 218 | * R("The President of the US") = unit obama = Just obama 219 | * R("The King of France") = Nothing 220 | 221 | Then once we lift into the monad, we have 222 | 223 | * Ann saw Bill = Just True 224 | * Ann saw the President of the US = Just False. 225 | * Ann saw the King of France = Nothing 226 | 227 | Just to be clear, evaluating "Ann saw Bill" means evaluating 228 | 229 | `(R Ann) (map2 saw) (R Bill)` 230 | 231 | -------------------------------------------------------------------------------- /monad-examps/reader.md: -------------------------------------------------------------------------------- 1 | # Context-sensitivity as side effect 2 | 3 | * Appositives and expressives are examples of expressions that *generate* 4 | additional data alongside the computation of their primary, at-issue content 5 | 6 | * But there are also plenty of examples of the obverse phenomenon: expressions 7 | that *consume* additional data as they compute their at-issue content 8 | 9 | * You might think of this as the denotation changing as a side-effect of begin 10 | evaluated in a different environment 11 | 12 | 13 | --- 14 | 15 | 16 | * Examples of context sharing in linguistics are easy to come by 17 | 18 | * indexicality 19 | * intensionality 20 | * assignment-sensitivity (anaphora, binding) 21 | * modal bases 22 | * negotiated vagueness thresholds 23 | * the meanings of words 24 | 25 | * Basically anything that you've ever seen grafted onto a pair of denotation 26 | brackets as a "parameter of evaluation" 27 | 28 | 29 | --- 30 | 31 | 32 | ``` 33 | Reader r a = r -> a 34 | 35 | return x = \r -> x 36 | m >>= k = \r -> k (m r) r 37 | ``` 38 | 39 | --- 40 | 41 | 42 | * This looks pretty familiar! 43 | 44 | > If \alpha is a terminal node occupied by a lexical item, then 45 | > for any assignment g, [[\alpha]]^g = [[\alpha]] 46 | > 47 | > If \alpha is a branching node and \{\beta, \gamma\} the set of its 48 | > daughters, then, for any assignment g, [...] 49 | > [[\alpha]]^g = [[\beta]]^g([[\gamma]]^g) 50 | 51 | -- Heim and Kratzer, *Semantics in Generative Grammar* 52 | 53 | 54 | * In other words, for lexical nodes \alpha, [[\alpha]] = `return` 55 | [[\alpha]], and for nonterminal nodes \alpha, [[\alpha]] = 56 | [[\beta]]`>>=` \lambda y\lambda g.[[\gamma]] g y 57 | -------------------------------------------------------------------------------- /monad-examps/set.md: -------------------------------------------------------------------------------- 1 | # List 2 | 3 | $$\text{Set}\, a = \{a\}$$ 4 | 5 | $$ 6 | \begin{array}{l} 7 | \eta\,x = \{x\}\\ 8 | m \star k = \{k\,x \mid x \in m\} 9 | \end{array} 10 | $$ 11 | -------------------------------------------------------------------------------- /monad-examps/state.md: -------------------------------------------------------------------------------- 1 | # Discourse referents as side effects 2 | 3 | * Here's a famous fact in linguistics: expressions in one sentence can *bind* 4 | pronouns in completely separate clauses 5 | 6 | * **John** left. **He** was whistling. 7 | * John **left**. So **did** Mary 8 | 9 | 10 | * One old intuition about what's happening here is that sentences manipulate a 11 | kind of contextual record on which we keep track of what's been talked about 12 | and when 13 | 14 | * In fact, in one tradition of *dynamic semantics*, sentences are actually 15 | nothing more than instructions for updating these sorts of records; truth and 16 | falsity are derivative notions 17 | 18 | 19 | --- 20 | 21 | 22 | * But the classic binding data doesn't by itself motivate abandoning good old 23 | truth-conditional content 24 | 25 | * We just need some way of tracking updates to the discourse state, *alongside* 26 | compositional evaluation 27 | 28 | * I.e., the generation of and sensitivity to discourse referents is a side 29 | effect of evaluating the meaning of a sentence 30 | 31 | 32 | --- 33 | 34 | 35 | * So we want a dynamic monad; it'll need to read in some sort of environment 36 | (the current state of the discourse), and write out some sort of new 37 | environment for future expressions that might depend on it 38 | 39 | * So we'll just glue our reader to our writer 40 | 41 | ``` 42 | State s a = s -> (a, s) 43 | 44 | return x = \s -> (x, s) 45 | m >>= k = \s -> k x s' 46 | where (x, s') = m s 47 | ``` 48 | 49 | 50 | --- 51 | 52 | 53 | * But as Hans can tell us 54 | -------------------------------------------------------------------------------- /monad-examps/writer.md: -------------------------------------------------------------------------------- 1 | # Side content as side effect 2 | 3 | ## Appositives 4 | 5 | > The concept of a monad, which arises from category theory, has been applied 6 | > by Moggi to structure the denotational semantics of programming languages 7 | 8 | -- Wadler (*Monads for Functional Programming*) 9 | 10 | * How should we represent the meaning of this sentence? 11 | 12 | * Two basic empirical facts to attend to: 13 | 14 | * The appositive seems to be invisible to other semantic operators 15 | 16 | *The concept of a monad, which arises from category theory, has not been 17 | applied to structure the semantics of languages* 18 | 19 | *Has the concept of a monad, which arises from category theory, been 20 | applied to structure the semantics of languages?* 21 | 22 | * The appositive is asserted, not presupposed 23 | 24 | 25 | --- 26 | 27 | 28 | * Constituents with appositive content seem to be two-dimensional, split into 29 | * a foreground component which absorbs the semantic blow from the rest of the 30 | sentence 31 | * and a background component which just hangs along for the ride 32 | 33 | * The concept structures the semantics of languages, The concept 34 | arises from category theory 35 | 36 | 37 | --- 38 | 39 | 40 | * Even though the secondary content is immune to semantic operations, it is 41 | persistent, and it *accumulates* 42 | 43 | *The concept of a monad, which arises from category theory, has been 44 | applied to structure the semantics of programming languages, which Montague 45 | thought were just like English* 46 | 47 | * The concept structures the semantics of languages, The concept 48 | arises from category theory **and** Montague thinks programming languages are 49 | like English 50 | 51 | 52 | --- 53 | 54 | 55 | ``` 56 | Writer w a = (a, w) 57 | 58 | return x = (x, ∅) 59 | m >>= k = (y, w ◇ w') 60 | where (x, w) = m 61 | (y, w') = k x 62 | ``` 63 | --------------------------------------------------------------------------------