Ticket #120 (new enhancement)

Opened 5 years ago

Last modified 5 years ago

Expose Prefs programmatically

Reported by: acfoltzer Owned by:
Priority: minor Milestone:
Version: Keywords:


Currently, the constructors for the Prefs record are opaque. Therefore, if a client application wishes to programmatically set non-default preferences, the only safe way is to write out a temp file in the .haskeline format, then read it back in.

It would be much simpler to either expose the constructors, or provide an API for changing the settings directly. I notice that older versions exposed this module, so perhaps there is a reason for keeping the actual constructors hidden while exposing enough to client code.

Change History

Changed 5 years ago by judah

Thanks for the suggestion! Out of curiosity, was there a particular preference you wanted to be able to change programmatically?

The original reason for hiding the Prefs constructor was so that we could add new preferences without making potentially breaking changes, which would require increasing haskeline's major version number. For that reason I'd still like to hide the Prefs constructor itself.

But it should be fine to export something like bellStyle :: Prefs -> BellStyle and setBellStyle :: BellStyle -> Prefs -> Prefs for each of the existing preferences. Note that bellStyle would have to become a separate function instead of a record accessor like it is now.

I probably won't have time to do this in the near future; any interest in submitting a patch?

Note: See TracTickets for help on using tickets.