[Haskell-cafe] Re: A new form of newtype

John Lato jwlato at gmail.com
Wed Dec 9 13:10:03 EST 2009

> From: "Richard O'Keefe" <ok at cs.otago.ac.nz>
> Subject: Re: [Haskell-cafe] A new form of newtype
> People are now writing EDSLs using Haskell to generate code for
> all sorts of interesting things.  What if you want to use Haskell
> as a host for an EDSL targeted at a 24-bit DSP?

*plug* for this specific case, I would use the word24 package,

which I wrote for a very similar problem.  It was surprisingly
difficult to get right (N.B. I have only tested the code, not proven
it correct).  I would have much preferred to let the compiler handle
the details.

> There may not be MACHINES with 42-bit integers,
> but that doesn't mean there aren't PROBLEMS that need them.
> This whole idea of "let the machine dictate the sizes" is
> precisely what I'm complaining of.
> Sorry, but creating instances of Bounded is what a compiler is for.
> If I don't write it, I won't wrong it.

I'm pretty sure I don't understand the syntax of your proposal (which
is my fault), but I definitely see the usefulness.  I'll leave the
syntax wrangling for the language lawyers, however.


More information about the Haskell-Cafe mailing list