5 ms·
> I don't use !!, or !$ Neither do I, intentionally at least. This week I encountered a very bizarre problem when running GHCi (a Haskell REPL), invoked from
by chriswarbo 10y ago
> I don't use !!, or !$
Neither do I, intentionally at least.
This week I encountered a very bizarre problem when running GHCi (a Haskell REPL), invoked from bash in an Emacs "shell" buffer.
In Haskell, "!!" is a function for getting an element from a list, e.g.
> let myList = ["a", "b", "c"]
> (myList !! 1, myList !! 2)
This would normally return the pair ("b", "c"), which GHCi prints to the screen. However, for some reason it was performing bash-like subtitution, giving me (on subsequent retries):
parse error on input 'let'
(myList (myList !! 1, myList !! 2) 1, myList (myList !! 1, myList !! 2) 2)
(myList (myList (myList !! 1, myList !! 2) 1, myList (myList !! 1, myList !! 2) 2) 1, myList (myList (myList !! 1, myList !! 2) 1, myList (myList !! 1, myList !! 2) 2) 2)
and so on exponentially!
- aardvark179 10y agoEnacs can be set to handle history substitution itself in various ways (the idea being that it can record an accurate history even when your shell can't). There's an option to configure if and when it does this, which you may want to set to never.