Haskeline history in the wrong order

210 views Asked by At

I'm using Haskeline to make a CLI interface for a program.

I use the basic configuration of Haskeline to save the commands stroked in a file.

mySettings = defaultSettings {
                               autoAddHistory = True
                             , historyFile = Just "hist.txt"
                             }

When I am in the command line interface, I can use the upper arrow to call the previous command. Things are working fine with the same behaviour than BASH or GHCi.

The file is correctly written and contain the commands in the right order (the first to the last)

After restarting my program I use the up arrow to call the last command stroked, and I get .... the first ! And each time I press the upper arrow, I get the next command (instead of the previous).

I'm surpised to have a the opposite behaviour when I restart my application.

Is it possible to reverse the order the commands are read in the file?

Is it possible to recall the commands in the right order after restarting a Haskeline CLI program ?

0

There are 0 answers