> Hi
> I am new to Haskell and have a question about types.
> 
> I have defined a type Type
> 
> data Type = D1        [Type]
>         | D2  String String [Type]
>         | D3  String String
>         | D4 ........
>         | ........
>           | D14
>          deriving (Show)
> 
> Where D4 - D14 each have 2-5 String
> 
> (I am using it together with the parser combinators from ParseLib
> if that makes any difference.)
> 
> Hugs98 complains that it can not derive Show after 40 iterations.
> I have to change the cutoff limit to 100 before it can derive Show.

I can confirm this behaviour
 
> In the Hugs manual it says that 
> 1, The default is 16
> 2, "We have not yet seen any examples of valid Hugs programs that 
> are rejected with this setting. It is possible to construct 
> artificial programs thatdo require higher values, but such examples 
> are pathological and they do not seem to appear in practice.)"
> 
> So 
> 1, If 16 is enough for all "normal" cases, why is the default on
> my system 40?
> 2, What makes my,  (simple), Type pathologcal?

I cant answer these questions, but the following 
works:

data DTag =     D1 
   |    D2 
   |    D3 
   |    D4 
   |    D5 
   |    D6 
   |    D7 
   |    D8 
   |    D9 
   |    D10
   |    D11
   |    D12
   |    D13
   |    D14
    deriving (Show)


data Dtype =    Dt1 DTag String 
   |    Dt2 DTag String String
   |    Dt3 DTag String String String
   |    Dt4 DTag String String String String
   |    Dt5 DTag String String String String String
    deriving (Show)

.But this will be much clumsier than the desired
type declaration.

Strange. I have built several toy parsers using
ParseLib, and I have not come across this problem.

Incidentally, you should check out Doatse Swierstra's 
parsing combinators, which are *very* impressive:

http://www.cs.uu.nl/groups/ST/Software/Parse/

(It took me a few days to work out how to use them,
but once you have done that, they are very quick to
use)

Regards,

Rob MacAulay 
Rob MacAulay              Vulcan Asic
email : [EMAIL PROTECTED]
http  : www.vulcanasic.com
Tel   +[44] 1763 247624      (direct)
Tel   +[44] 1763 248163      (office)
Fax   +[44] 1763 241291
http: www.vulcanasic.com


Reply via email to