Effect

From The Toaq Wiki

An effect is a concept from programming languages: there, it describes a way in which something that behaves essentially like a function that takes an "A" and returns a "B" might do more than just that pure computation (that is: it may have "side effects").

It turns out that we can apply a similar perspective to natural language semantics by describing certain processes as "effects", and this plays very nicely with existing ideas about compositional syntax.

Examples from programming

Let's consider possible "side effects" of a function A → B. It might...

  • throw an error of type Err instead of actually returning a result of type B.
  • return some "log" data alongside its result of type B.
  • depend on / read some "environment" data in order to produce a result of type B.

One way a programming language can encode this is using monads. Basically, we say we have functions of types like

  • A → Either Err B
  • A → Writer Log B
  • A → Reader Env B

and we rely on some way to compose these functions, while propagating their effects.

  • We can compose two throwing functions into a larger throwing function.
  • We can compose two logging functions into a larger logging function.
  • We can compose two functions that read from the environment into a larger such function.

By composing many functions with different effects, we arrive at one big function that is clear about the essential data types involved in its transformation, while also describing the exact "effectful context" it wants to run in (does it need a "catch Err" block? some sink to collect logs? some source of environment data?)

In syntax

It turns out that we can extend this concept to syntax. For example, consider a noun phrase with an apposition, like Mary, a linguist. This seems to be essentially (syntactically) an entity of type e that also wants to "write" a presupposition like "Mary is a linguist" to some environment. So, we say that it is an entity e in an effectful context W, and we write this as the subtree having type W e.

When we move up the tree to a bigger constituent like John saw Mary, a linguist, we want to keep this effectful context and "lift" the rest of the sentence, John saw (of type e → t), into it. We first turn e → t into W (e → t) and then compose this with our W e to get a W t.

Similarly, a pronoun like her can be considered to be an entity e in an effectful "reader" context that provides a value for the binding: its type is R e. This, again, might compose the same way to form a larger constituent like John saw her, of type R t.

When we compose the meaning of two effectful constituents, we have to pick a way to combine the contexts. For example, John saw Mary, a linguist might have type R (W t) or type W (R t). It depends on which effect we lift "into" the other effect before combining them.

Eventually, we arrive at a denoted sentence wrapped in a list of effects (presuppositions, bindings, focus…) gathered from everywhere in the sentence.

When parsing English, the freedom you have in deciding how to combine effects accounts for syntactic ambiguity. In an effectful version of Kuna, we'd have a handful of rules saying exactly how effects combine, and this would answer questions about scope.

See also