ghc: Init

This only adds the configuration, not the packages, because they are
massive.
This commit is contained in:
Simon Bruder 2021-09-03 20:04:40 +02:00
parent d621e84a00
commit aceeb7c35a
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
2 changed files with 33 additions and 0 deletions

View file

@ -3,6 +3,7 @@
./alacritty.nix ./alacritty.nix
./anki ./anki
./games.nix ./games.nix
./ghci.nix
./git.nix ./git.nix
./gpg.nix ./gpg.nix
./gtk.nix ./gtk.nix

View file

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