Hacker News new | ask | show | jobs
by _0w8t 3121 days ago
Git rebase alters the structures that are relevant for me, like heads of named branches. In Haskell let bindings are immutable. To reference to the results one has to put them into new bindings. I.e. if Git was purely functional, the rebase would create new names for branches.
4 comments

You can easily shadow a name in a let binding in Haskell

For example,

let x = 5 in let x = 6 in putStrLn (show x)

would print 6. Unless you turn on compiler warnings, there is never a need to choose new names for variables if the old version is no longer needed.

Shadowing isn't the same thing as redefining. Try evaluating the following expression:

    let x = 4 ; f y = x + y in let x = 6 in f 10
If you want immutable branches, you can use tags https://git-scm.com/book/en/v2/Git-Basics-Tagging
> In Haskell let bindings are immutable.

Haskell has mutable refs. That's what Git branches are.

But the contents of a mutable ref aren't let-bound.
So your entire point amounts to naming?