Hi,

 

I’m curious about how the Haskell compilers nowadays take care of a simple function definition like append

 

append [] l = l

append (h:t) l = h: (append t l)

 

 

Do they take a rewriting way like

 

append [1,2] [3,4]   è 1: (append [2] [3,4])

                             è 1: (2 : (append [] [3,4]) )

                             è 1 : (2: [3,4])

                             è [1,2,3,4]

 

Or do they converte the append definintion to some lambda-calculus flavour language

 

append = Y (\f -> \l1 l2 -> case l1 of 

                                         [] -> l2

                                         (h:t) -> h: (f t l2))

 

And then apply this converted definition to the arguments?

 

Best

Miguel