Implementing Haskell's Type-Level Quicksort in D
Philippe Sigaud
philippe.sigaud at gmail.com
Tue Feb 11 11:12:50 PST 2014
On Mon, Feb 10, 2014 at 6:12 PM, Meta <jared771 at gmail.com> wrote:
> I'm trying to write a D implementation of Haskell's "type level
> quicksort"[0], but I'm already running into problems with
> std.typecons.Typedef. I have tried to translate this Haskell code:
> alias One = Typedef!(Succ!Zero);
> alias Two = Typedef!(Succ!One);
> alias Three = Typedef!(Succ!Two);
> alias Four = Typedef!(Succ!Three);
Did you try just using:
alias One = Succ!Zero;
alias Two = Succ!One;
alias Three = Succ!Two;
alias Four = Succ!Three;
?
I remember having fun implementing type-level addition and
multiplication using D and this Peano construct, so Quicksort is
probably possible.
More information about the Digitalmars-d-learn
mailing list