nixos-config/users/simon/modules/ghci.nix

33 lines
1.4 KiB
Nix
Raw Normal View History

{ 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
];
}