Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Windows support #120

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Improve Windows support #120

wants to merge 5 commits into from

Conversation

bjartur
Copy link

@bjartur bjartur commented Sep 7, 2019

Looking for preferences in $XDG_CONFIG_HOME or %APPDATA% improves standards conformance. In addition to resulting in a more predictable preference file location on Windows NT, it enables tidier ~ directories on all platforms. Declaring the text files in this repository as using LF terminated lines improves the contribution experience on legacy operating systems such as DOS, Windows and classic (pre-Darwin) Mac OS.

On legacy operating systems, lines in text files in the working tree might be CR
or CRLF separated instead of being LF terminated. The .gitattributes file
instructs Git on legacy systems to transform such text files into LF text files when reading them,
preserving text files as LF text files in the repository.
In addition to looking for preferences in a dotfile in ~, look for
preferences in accordance with the XDG Base Directory Specification or in
%APPDATA% in accordance with Windows NT convention.
Note that on Windows, ~ is, surprisingly in the context of preferences,
%USERPROFILE%, not %HOME% or %APPDATA%.
Data.Functor.(<&>) was introduced in base 4.11.0 (shipped with GHC in 2018 Q1).
Copying the function definition allows haskeline to be built with base and GHC
dating from 2016 Q1.
Aim: to simplify testing of error handling later on.
Rationale: a happy case needed for backwards-compatibility and discoverability,
namely reading preferences from ~/.haskeline, is also an error case, namely the case of
$XDG_CONFIG_HOME/haskeline/preferences (or equivalent) being unreadable (e.g. nonexistent).

IO actions are factored out of the error checking, which instead depend on [],
Maybe, MonadPlus and MonadCatch.
readPrefs has hitherto, save for a few commits, and should continue to,
read preferences from a given FilePath.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant