Created
August 3, 2018 12:07
-
-
Save JustusAdam/9025e58967c5cafefda0edba92274bab to your computer and use it in GitHub Desktop.
I'm weird, so I made a haskell script to generate my ghci config.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!stack runhaskell | |
import Data.Monoid | |
import Text.Printf | |
data ExtsHelper | |
= Prefixed String | |
[ExtsHelper] | |
| Values [String] | |
exts :: [ExtsHelper] | |
exts = | |
[ Prefixed "Overloaded" [Values ["Strings", "Lists"]] | |
, Prefixed | |
"Derive" | |
[ Values | |
[ "Functor" | |
, "Generic" | |
, "Traversable" | |
, "Foldable" | |
, "DataTypeable" | |
] | |
] | |
, Prefixed "Flexible" [Values ["Instances", "Contexts"]] | |
, Prefixed "Type" [Values ["SynonymInstances", "Operators", "Families"]] | |
, Values | |
[ "ExistentialQuantification" | |
, "FunctionalDependencies" | |
, "RankNTypes" | |
, "LambdaCase" | |
, "TupleSections" | |
, "MultiParamTypeClasses" | |
, "MultiWayIf" | |
, "NamedFieldPuns" | |
, "RecordWildCards" | |
, "PartialTypeSignatures" | |
, "QuasiQuotes" | |
, "TemplateHaskell" | |
, "ScopedTypeVariables" | |
, "StandaloneDeriving" | |
, "GADTs" | |
, "ViewPatterns" | |
] | |
] | |
flattenExts :: ExtsHelper -> [String] | |
flattenExts (Prefixed p vals) = vals >>= map (p <>) . flattenExts | |
flattenExts (Values v) = v | |
main :: IO () | |
main = | |
writeFile ".ghci" $ | |
printf | |
":set %v\n:set prompt \"λ>\"\n" | |
(unwords $ map ("-X" <>) $ concatMap flattenExts exts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment