Alastair Reid writes:
>
> Sigbjorn writes:
>
> > the following code causes Hugs (June'98) to complain
> >
> > module Foo where
> >
> > data A = A1 | .... | A101
> >
> > aToInt :: A -> Int
> > aToInt x =
> > case x of { A1 -> 1 ; .. ; An -> n ; ... A101 -> 101 }
> >
> > with
> >
> > ERROR "foo.hs": Compiled code too complex
> >
> > (This problem is a "Real" one - it shows up in a Haskell Office'97 library.)
>
> The what?
> You guys at Glasgow are re-implementing Office'97 in Haskell?
> Shouldn't you wait until you're working at Microsoft before
> you start hacking on MS products? :-)
>
That's right, since we're using Haskell for the job I expect this to
take 3-4 weeks (max) to complete :-) Seriously, the library in
question is just a Haskell binding to the Word, Excel & Powerpoint
APIs, and is automatically generated by H/Direct.
> > i.e., the compile-time constant NUM_FIXUPS is exceeded. Working around
> > this isn't hard, but it'd be nice if there was no hard-wired fixup
> > limit, since it requires non-local users of Foo to also have to
> > recompile Hugs with a bigger setting of said constant. [ Yes, I know I
> > can work around the problem on the Haskell side by splitting up a big
> > case statement into smaller ones, but I'd prefer not to. ]
>
> Tommy Thorn has already persuaded me to increase it a bit (it's
> 400 in my current system).
> Conal Elliott has persuaded me to fix a bunch of minor problems so
> I'll be cutting a new release (with this chance) RSN. Then I'll
> quickly announce it on the big mailing lists before any more requests
> have a chance to arrive.
>
Sounds great, I'll manage just fine with 400.
>
> ps Wouldn't it be easier to derive Enum for this particular piece of
> code?
Yes, but the Real example that showed this up came from code generated
from an IDL enum typedef where the enumeration tags map onto a
non-contiguous range of ints. Thanks for the suggestion though, the
IDL compiler should probably check to see whether it could use
"deriving Enum" for enum type decls.
--Sigbjorn