[Haskell-cafe] Type system

Dan Piponi dpiponi at gmail.com
Fri Mar 14 17:29:41 EDT 2008


On Fri, Mar 14, 2008 at 11:50 AM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> Haskell has an expressive and powerful type system - which I love. It
>  also has a seemingly endless list of weird and obscure type system
>  extensions...And yet, none of this happens in any other programming language I've
>  met.

Have you ever programmed in C++? Many of the exotic things that can be
done in the Haskell type system can also be carried out in the C++
type system - ranging from factoring integers at compile time to
implementing highly optimised array and matrix DSLs. The difference
between C++ and Haskell is that in C++ these techniques are highly ad
hoc. In the Haskell world people are a lot more conservative and so
only allow type system shenanigans if they are supported by some
theory that allows us to reason nicely about them. As a side effect,
each type system extension is relatively small and controlled. So when
you see lots of Haskell type system extensions it looks like a big
complicated system, but that's just an illusion that results from it
being broken down into reasonable pieces. Read some of the source code
for the Boost C++ template libraries (especially the template
metaprogramming library) to see how complex the C++ type system really
is.
--
Dan


More information about the Haskell-Cafe mailing list