[Haskell-cafe] Definition of List type?

wren ng thornton wren at freegeek.org
Sat Jul 31 00:50:12 EDT 2010


Ben Millwood wrote:
> On Fri, Jul 30, 2010 at 7:50 PM, Gregory Crosswhite
> <gcross at phys.washington.edu> wrote:
>> The reason why this definition never actually appears is because it defines the constructors using operators rather than names, which is not allowed in vanilla Haskell.  (There is an extension, TypeOperators, however, that does allow this.)
>>
> 
>  Nope: see Data.Complex.Complex; only infix *type* constructors are
> nonstandard. The thing about lists that makes them impossible to
> define in normal Haskell is the [a] syntax, which is some kind of
> "outfix" type constructor, which no amount of currently available
> extensions will allow.

It's normally called "confix" or "circumfix".

Similarly, the tuple syntaxes can't be defined in Haskell because they 
use "mixfix" notation (which apparently some folks call "distfix"[1]). 
Also, lists support a mixfix sugar where [a,b,...,c] = a:b:...:c:[]

Agda does support full mixfix notation. While it's nice in theory, when 
combined with the verbosity of dependently typed languages it gets 
illegible pretty quickly for the uninitiated.


[1] http://github.com/noteed/syntactical

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list