On Tuesday, 11 February 2014 at 19:13:01 UTC, Philippe Sigaud wrote:
On Mon, Feb 10, 2014 at 6:12 PM, Meta <jared...@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.

I have tried once before only semi-seriously, and using just a bare alias was my initial strategy. It didn't work for some reason, and I can't really remember why. Maybe I'll give it another try and just drop the Typedef.

Reply via email to