Hi,
Given the following enumerated type (as an example)

data P = A | B | C | D | E 
         deriving (Show,Enum)

and the Prelude definition: 
            enumFrom x  = map toEnum [ fromEnum x ..]

I guess that  the two expressions 
        1) (map toEnum [ fromEnum A ..]) :: [P]
        2)  enumFrom A 
should produces the same result, say 
        [A,B,C,D,E] :: [P] 

However, the expression 1)  produces an error as a consequence of trying to
apply toEnum to the number 5.
¿Why the expression 2) doesn't not produce the same error?
¿Does Hugs not apply the definition in the Prelude for evaluating the
expression 2)?
There should be something that I'm missing in this computation. 
Some hints?

Thanks in advance,
Paqui

--------------------------------- 
Paqui Lucio                                
Dpto de LSI                    
Facultad de Informática
Paseo Manuel de Lardizabal, 1
20080-San Sebastián
SPAIN
---------------------------------
e-mail: paqui.lu...@ehu.es
Tfn: (+34) (9)43 015049  
Fax: (+34) (9)43 015590
Web: http://www.sc.ehu.es/paqui
---------------------------------

_______________________________________________
Hugs-Users mailing list
Hugs-Users@haskell.org
http://www.haskell.org/mailman/listinfo/hugs-users

Reply via email to