list - Why does this function give rise to an infinite loop? -


i trying solve exercises haskell course found online , this question, have following implementation:

reverse ::   list   -> list reverse nil = nil reverse (x :. xs) = let l = (reverse xs) in l ++ (x:.nil) 

with list being defined as:

data list t =   nil   | t :. list t   deriving (eq, ord) 

it seems there infinite loop inside function. not find out why. enlighten me?

this correct implementation of reverse definition of list in exercise book. if there infinite loop somewhere in implementation of (++).


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -