diff --git a/users/simon/modules/default.nix b/users/simon/modules/default.nix index 40ef9d9..ab9ea6e 100644 --- a/users/simon/modules/default.nix +++ b/users/simon/modules/default.nix @@ -3,6 +3,7 @@ ./alacritty.nix ./anki ./games.nix + ./ghci.nix ./git.nix ./gpg.nix ./gtk.nix diff --git a/users/simon/modules/ghci.nix b/users/simon/modules/ghci.nix new file mode 100644 index 0000000..30d365f --- /dev/null +++ b/users/simon/modules/ghci.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: + +{ + home.file.".ghc/ghci.conf".text = /* haskell */ '' + :seti -XOverloadedStrings + + -- Lambdabot (from https://wiki.haskell.org/GHC/GHCi#Lambdabot_Commands) + dotGHCI_escapeShellArg arg = "'" ++ concatMap (\c -> if c == '\''' then "'\\'''" else [c]) arg ++ "'" + lb s1 s2 = return $ ":!lambdabot -n -e " ++ dotGHCI_escapeShellArg s1 ++ "\\ " ++ dotGHCI_escapeShellArg s2 + :def! lb lb "" -- runs arbitrary lambdabot commands + :def! pl lb "pl" -- converts code to point-free (aka pointless) form + :def! unpl lb "unpl" -- converts back from point-free (aka pointless) form + :def! do lb "do" -- converts binds to do notation + :def! undo lb "undo" -- converts do blocks to bind notation + :def! index lb "index" -- finds the module that defines the given identifier + :def! instances lb "instances" -- finds all instances of a given type class + :def! src lb "src" -- tries to find the source code for the given identifier + :def! oeis lb "oeis" -- looks up the On-Line Encyclopedia of Integer Sequences (https://oeis.org/) + ''; + + home.file.".haskeline".text = '' + completionType: MenuCompletion + maxHistorySize: Just 10000 + historyDuplicates: IgnoreAll + ''; + + home.packages = with pkgs; [ + # GHC has a huge closure size, instead use nix-shell (ad-hoc or per-project) + #ghc + #lambdabot + ]; +}