.ghci 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. -- Loads the appropriate .ghci file
  2. -- (.ghci-9.0, .ghci-8.10, .ghci-8.8, .ghci-8.6, .ghci-8.2, .ghci-8.0)
  3. --
  4. :{
  5. :def agda_load_ghci_by_version \varcmd ->
  6. let
  7. ghcVersion = Data.Version.versionBranch System.Info.compilerVersion
  8. in
  9. if (length ghcVersion /= 2)
  10. then return "putStrLn \"Strange GHC version…\""
  11. else if ghcVersion >= [9,0]
  12. then return ":script .ghci-9.0"
  13. else if ghcVersion >= [8,10]
  14. then return ":script .ghci-8.10"
  15. else if ghcVersion >= [8,8]
  16. then return ":script .ghci-8.8"
  17. else if ghcVersion >= [8,6]
  18. then return ":script .ghci-8.6"
  19. else if ghcVersion >= [8,2]
  20. then return ":script .ghci-8.2"
  21. else if ghcVersion >= [8,0]
  22. then return ":script .ghci-8.0"
  23. else return "putStrLn \"Unsupported GHC version\""
  24. :}
  25. :agda_load_ghci_by_version
  26. :undef agda_load_ghci_by_version
  27. -- Loads a ".ghci.local" file if it exists.
  28. -- That file is gitignored, so you may edit it freely.
  29. --
  30. -- Put any local .ghci customizations there and they will not be overwritten
  31. -- by checkouts, nor cause git to appear dirty. Some nice ideas for you which
  32. -- may become defaults at some point in the future:
  33. -- :set +c
  34. -- :set -fdefer-out-of-scope-variables
  35. -- :set -fdefer-type-errors
  36. -- :set -fdefer-typed-holes
  37. -- :set -ferror-spans
  38. -- :set -fhelpful-errors
  39. :{
  40. :def agda_load_local_ghci \_ -> do
  41. let localGhci = ".ghci.local"
  42. exists <- System.Directory.doesFileExist localGhci
  43. return $ if exists
  44. then ":script " ++ localGhci
  45. else ""
  46. :}
  47. :agda_load_local_ghci
  48. :undef agda_load_local_ghci