Changes between Initial Version and Version 1 of Ticket #5572


Ignore:
Timestamp:
Oct 21, 2011 4:33:11 PM (4 years ago)
Author:
simonpj
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5572 – Description

    initial v1  
    11Environment of work
    22-------------------------------------------------------------------
     3{{{
    34Ubuntu 11.10
    45
     
    1213....
    1314gcc versión 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
     15}}}
    1416-------------------------------------------------------------------
    1517
     
    1921
    2022I composed the function
    21 
     23{{{
    2224factorial :: Integer -> Integer
    2325factorial 0 = 1
    2426factorial (n+1) = (n+1) * factorial n
    25 
     27}}}
    2628in the file "factorial.hs". So I make
    27 
     29{{
    2830$ ghci factorial
    29 
     31}}}
    3032and then ghci produces the message
    31 
     33{{{
    3234GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
    3335Loading package ghc-prim ... linking ... done.
     
    3941Failed, modules loaded: none.
    4042Prelude>
    41 
     43}}}
    4244
    4345therefore I changed the content of factorial.hs to
    44 
     46{{{
    4547fact :: Integer -> Integer
    4648fact 0 = 1
    4749fact n = n * fact (n-1)
    48 
     50}}}
    4951now I make
    50 
     52{{{
    5153Prelude> :l factorial.hs
    52 
     54}}}
    5355obtaining the dialog
    54 
     56{{{
    5557[1 of 1] Compiling Main             ( factorial.hs, interpreted )
    5658Ok, modules loaded: Main.
    5759*Main>
    58 
     60}}}
    5961but "the problem" is that the simple computation
    60 
     62{{{
    6163*Main> factorial (-1)
    62 
     64}}}
    6365produces
    64 
     66{{{
    6567*** Exception: stack overflow
    66 
     68}}}
    6769In GHCi version 6.10.4 there is no bug ... or problem