[TYPES] breaking abstraction with ML exceptions

2018-03-28 Thread Sam Lindley
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] The following SML program exception C; structure M :> sig exception A end = struct exception A = C end; (raise M.A) handle C => 42 returns the value 42 (according to SML/NJ and, I believe, the 1997

Re: [TYPES] What algebra am I thinking of?

2018-03-28 Thread Neel Krishnaswami
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] Hi Phil, I learned about this from Martin Escardo, and he told me the observation about monoidal closure is in Lawvere's paper "Metric Spaces, Generalized Logic, and Closed Categories". One further observation I have

Re: [TYPES] breaking abstraction with ML exceptions

2018-03-28 Thread Derek Dreyer
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] Hi, Sam. I would take issue with your characterization of this example as "breaking abstraction". By way of analogy, when you opaquely seal a module with a signature containing a field val v : T, it does not mean

Re: [TYPES] breaking abstraction with ML exceptions

2018-03-28 Thread Sam Lindley
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] Thanks Derek. My subject line is deliberately provocative. Given that exceptions in ML are values that inhabit a single type, the behaviour does make sense, and is rather unsurprising if we rewrite M as:

Re: [TYPES] What algebra am I thinking of?

2018-03-28 Thread Francesco Gavazzo
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] I am not sure whether the following is the correct definition of a monus, but following Neel (as well as the analogy with natural numbers) one could look at monus in a monoid as right adjoint to monoid multiplication. In

Re: [TYPES] breaking abstraction with ML exceptions

2018-03-28 Thread Gabriel Scherer
[ The Types Forum, http://lists.seas.upenn.edu/mailman/listinfo/types-list ] While I cannot comment on how often this occurs in practice, I'd like to point out that this ability to hide equalities between exceptions has delicate implications for the compilation of pattern-matching (in