-- Warning: do not add anything here that might conflict with a developer's
-- local `.ghci` configuration. As a rule of thumb, defining new commands using
-- `:new` should be safe, but using `:set` to set configuration options is
-- probably not.

import Prelude

-- Making a list out of all library modules in the `.cabal` file, so we have
-- access to everything from the REPL. I don't know of a better way to do this.
-- As new modules get added to the codebase, this list will become incomplete.
-- This shouldn't be a big deal, new modules can be added as the need arises.
:{
let gargantextModules = [ "Gargantext"
                        , "Gargantext.API"
                        , "Gargantext.API.Admin.Auth.Types"
                        , "Gargantext.API.Admin.EnvTypes"
                        , "Gargantext.API.Admin.Orchestrator.Types"
                        , "Gargantext.API.Admin.Settings"
                        , "Gargantext.API.Auth.PolicyCheck"
                        , "Gargantext.API.Count.Types"
                        , "Gargantext.API.Dev"
                        , "Gargantext.API.Errors"
                        , "Gargantext.API.Errors.Class"
                        , "Gargantext.API.Errors.TH"
                        , "Gargantext.API.Errors.Types"
                        , "Gargantext.API.Errors.Types.Backend"
                        , "Gargantext.API.HashedResponse"
                        , "Gargantext.API.Middleware"
                        , "Gargantext.API.Ngrams"
                        , "Gargantext.API.Ngrams.List"
                        , "Gargantext.API.Ngrams.List.Types"
                        , "Gargantext.API.Ngrams.Prelude"
                        , "Gargantext.API.Ngrams.Tools"
                        , "Gargantext.API.Ngrams.Types"
                        , "Gargantext.API.Node"
                        , "Gargantext.API.Node.Corpus.New"
                        , "Gargantext.API.Node.Corpus.New.Types"
                        , "Gargantext.API.Node.Corpus.Types"
                        , "Gargantext.API.Node.Corpus.Update"
                        , "Gargantext.API.Node.File"
                        , "Gargantext.API.Node.File.Types"
                        , "Gargantext.API.Node.Share"
                        , "Gargantext.API.Node.Share.Types"
                        , "Gargantext.API.Node.ShareURL"
                        , "Gargantext.API.Node.Types"
                        , "Gargantext.API.Node.Update"
                        , "Gargantext.API.Node.Update.Types"
                        , "Gargantext.API.Prelude"
                        , "Gargantext.API.Routes"
                        , "Gargantext.API.Routes.Named"
                        , "Gargantext.API.Routes.Named.Annuaire"
                        , "Gargantext.API.Routes.Named.Contact"
                        , "Gargantext.API.Routes.Named.Context"
                        , "Gargantext.API.Routes.Named.Corpus"
                        , "Gargantext.API.Routes.Named.Count"
                        , "Gargantext.API.Routes.Named.Document"
                        , "Gargantext.API.Routes.Named.EKG"
                        , "Gargantext.API.Routes.Named.File"
                        , "Gargantext.API.Routes.Named.FrameCalc"
                        , "Gargantext.API.Routes.Named.List"
                        , "Gargantext.API.Routes.Named.Metrics"
                        , "Gargantext.API.Routes.Named.Node"
                        , "Gargantext.API.Routes.Named.Private"
                        , "Gargantext.API.Routes.Named.Public"
                        , "Gargantext.API.Routes.Named.Search"
                        , "Gargantext.API.Routes.Named.Share"
                        , "Gargantext.API.Routes.Named.Table"
                        , "Gargantext.API.Routes.Named.Tree"
                        , "Gargantext.API.Routes.Named.Viz"
                        , "Gargantext.API.Routes.Types"
                        , "Gargantext.API.Types"
                        , "Gargantext.API.Viz.Types"
                        , "Gargantext.Core"
                        , "Gargantext.Core.Config"
                        , "Gargantext.Core.Config.Ini.Ini"
                        , "Gargantext.Core.Config.Ini.Mail"
                        , "Gargantext.Core.Config.Ini.NLP"
                        , "Gargantext.Core.Config.Mail"
                        , "Gargantext.Core.Config.NLP"
                        , "Gargantext.Core.Config.Types"
                        , "Gargantext.Core.Config.Utils"
                        , "Gargantext.Core.Mail.Types"
                        , "Gargantext.Core.Methods.Similarities"
                        , "Gargantext.Core.Methods.Similarities.Conditional"
                        , "Gargantext.Core.NLP"
                        , "Gargantext.Core.NodeStory"
                        , "Gargantext.Core.NodeStory.DB"
                        , "Gargantext.Core.NodeStory.Types"
                        , "Gargantext.Core.Notifications"
                        , "Gargantext.Core.Notifications.CentralExchange"
                        , "Gargantext.Core.Notifications.CentralExchange.Types"
                        , "Gargantext.Core.Notifications.Dispatcher"
                        , "Gargantext.Core.Notifications.Dispatcher.Subscriptions"
                        , "Gargantext.Core.Notifications.Dispatcher.Types"
                        , "Gargantext.Core.Notifications.Dispatcher.WebSocket"
                        , "Gargantext.Core.Notifications.Nanomsg"
                        , "Gargantext.Core.Text"
                        , "Gargantext.Core.Text.Context"
                        , "Gargantext.Core.Text.Corpus.API"
                        , "Gargantext.Core.Text.Corpus.API.Arxiv"
                        , "Gargantext.Core.Text.Corpus.API.EPO"
                        , "Gargantext.Core.Text.Corpus.API.OpenAlex"
                        , "Gargantext.Core.Text.Corpus.API.Pubmed"
                        , "Gargantext.Core.Text.Corpus.Parsers"
                        , "Gargantext.Core.Text.Corpus.Parsers.Date"
                        , "Gargantext.Core.Text.Corpus.Parsers.TSV"
                        , "Gargantext.Core.Text.Corpus.Query"
                        , "Gargantext.Core.Text.List"
                        , "Gargantext.Core.Text.List.Formats.TSV"
                        , "Gargantext.Core.Text.List.Group.WithStem"
                        , "Gargantext.Core.Text.List.Social"
                        , "Gargantext.Core.Text.Metrics"
                        , "Gargantext.Core.Text.Metrics.CharByChar"
                        , "Gargantext.Core.Text.Metrics.Count"
                        , "Gargantext.Core.Text.Metrics.TFICF"
                        , "Gargantext.Core.Text.Ngrams"
                        , "Gargantext.Core.Text.Terms"
                        , "Gargantext.Core.Text.Terms.Eleve"
                        , "Gargantext.Core.Text.Terms.Mono"
                        , "Gargantext.Core.Text.Terms.Mono.Stem"
                        , "Gargantext.Core.Text.Terms.Mono.Stem.Internal.GargPorter"
                        , "Gargantext.Core.Text.Terms.Mono.Stem.Internal.Lancaster"
                        , "Gargantext.Core.Text.Terms.Mono.Stem.Internal.Porter"
                        , "Gargantext.Core.Text.Terms.Multi"
                        , "Gargantext.Core.Text.Terms.Multi.Lang.En"
                        , "Gargantext.Core.Text.Terms.Multi.Lang.Fr"
                        , "Gargantext.Core.Text.Terms.Multi.RAKE"
                        , "Gargantext.Core.Text.Terms.WithList"
                        , "Gargantext.Core.Types"
                        , "Gargantext.Core.Types.Individu"
                        , "Gargantext.Core.Types.Main"
                        , "Gargantext.Core.Types.Phylo"
                        , "Gargantext.Core.Types.Query"
                        , "Gargantext.Core.Utils"
                        , "Gargantext.Core.Utils.Prefix"
                        , "Gargantext.Core.Viz.Graph.Index"
                        , "Gargantext.Core.Viz.Graph.Tools"
                        , "Gargantext.Core.Viz.Graph.Tools.IGraph"
                        , "Gargantext.Core.Viz.Graph.Types"
                        , "Gargantext.Core.Viz.Phylo"
                        , "Gargantext.Core.Viz.Phylo.API"
                        , "Gargantext.Core.Viz.Phylo.API.Tools"
                        , "Gargantext.Core.Viz.Phylo.Example"
                        , "Gargantext.Core.Viz.Phylo.PhyloExport"
                        , "Gargantext.Core.Viz.Phylo.PhyloMaker"
                        , "Gargantext.Core.Viz.Phylo.PhyloTools"
                        , "Gargantext.Core.Viz.Phylo.SynchronicClustering"
                        , "Gargantext.Core.Viz.Types"
                        , "Gargantext.Database.Action.Flow"
                        , "Gargantext.Database.Action.Flow.Types"
                        , "Gargantext.Database.Action.Metrics.TFICF"
                        , "Gargantext.Database.Action.Search"
                        , "Gargantext.Database.Action.User"
                        , "Gargantext.Database.Action.User.New"
                        , "Gargantext.Database.Admin.Config"
                        , "Gargantext.Database.Admin.Trigger.Init"
                        , "Gargantext.Database.Admin.Types.Hyperdata"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Corpus"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Document"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Folder"
                        , "Gargantext.Database.Admin.Types.Node"
                        , "Gargantext.Database.Prelude"
                        , "Gargantext.Database.Query.Facet"
                        , "Gargantext.Database.Query.Table.Ngrams"
                        , "Gargantext.Database.Query.Table.NgramsPostag"
                        , "Gargantext.Database.Query.Table.Node"
                        , "Gargantext.Database.Query.Table.Node.Error"
                        , "Gargantext.Database.Query.Table.Node.UpdateOpaleye"
                        , "Gargantext.Database.Query.Table.User"
                        , "Gargantext.Database.Query.Tree.Root"
                        , "Gargantext.Database.Schema.Ngrams"
                        , "Gargantext.Database.Schema.Node"
                        , "Gargantext.Database.Schema.User"
                        , "Gargantext.Defaults"
                        , "Gargantext.MicroServices.ReverseProxy"
                        , "Gargantext.System.Logging"
                        , "Gargantext.Utils.Dict"
                        , "Gargantext.Utils.Jobs"
                        , "Gargantext.Utils.Jobs.Error"
                        , "Gargantext.Utils.Jobs.Internal"
                        , "Gargantext.Utils.Jobs.Map"
                        , "Gargantext.Utils.Jobs.Monad"
                        , "Gargantext.Utils.Jobs.Queue"
                        , "Gargantext.Utils.Jobs.Settings"
                        , "Gargantext.Utils.Jobs.State"
                        , "Gargantext.Utils.SpacyNLP"
                        , "Gargantext.Utils.SpacyNLP.Types"
                        , "Gargantext.Utils.Tuple"
                        , "Gargantext.Utils.Zip"
                        , "Gargantext.API.Admin.Auth"
                        , "Gargantext.API.Admin.FrontEnd"
                        , "Gargantext.API.Context"
                        , "Gargantext.API.Count"
                        , "Gargantext.API.EKG"
                        , "Gargantext.API.GraphQL"
                        , "Gargantext.API.GraphQL.Annuaire"
                        , "Gargantext.API.GraphQL.AsyncTask"
                        , "Gargantext.API.GraphQL.Context"
                        , "Gargantext.API.GraphQL.IMT"
                        , "Gargantext.API.GraphQL.NLP"
                        , "Gargantext.API.GraphQL.Node"
                        , "Gargantext.API.GraphQL.PolicyCheck"
                        , "Gargantext.API.GraphQL.Team"
                        , "Gargantext.API.GraphQL.TreeFirstLevel"
                        , "Gargantext.API.GraphQL.Types"
                        , "Gargantext.API.GraphQL.UnPrefix"
                        , "Gargantext.API.GraphQL.User"
                        , "Gargantext.API.GraphQL.UserInfo"
                        , "Gargantext.API.GraphQL.Utils"
                        , "Gargantext.API.Job"
                        , "Gargantext.API.Members"
                        , "Gargantext.API.Metrics"
                        , "Gargantext.API.Ngrams.NgramsTree"
                        , "Gargantext.API.Node.Contact"
                        , "Gargantext.API.Node.Contact.Types"
                        , "Gargantext.API.Node.Corpus.Annuaire"
                        , "Gargantext.API.Node.Corpus.Export"
                        , "Gargantext.API.Node.Corpus.Export.Types"
                        , "Gargantext.API.Node.Corpus.Searx"
                        , "Gargantext.API.Node.Document.Export"
                        , "Gargantext.API.Node.Document.Export.Types"
                        , "Gargantext.API.Node.Phylo.Export"
                        , "Gargantext.API.Node.Phylo.Export.Types"
                        , "Gargantext.API.Node.DocumentUpload"
                        , "Gargantext.API.Node.DocumentUpload.Types"
                        , "Gargantext.API.Node.DocumentsFromWriteNodes"
                        , "Gargantext.API.Node.DocumentsFromWriteNodes.Types"
                        , "Gargantext.API.Node.FrameCalcUpload"
                        , "Gargantext.API.Node.FrameCalcUpload.Types"
                        , "Gargantext.API.Node.Get"
                        , "Gargantext.API.Node.New"
                        , "Gargantext.API.Node.New.Types"
                        , "Gargantext.API.Public.Types"
                        , "Gargantext.API.Search"
                        , "Gargantext.API.Search.Types"
                        , "Gargantext.API.Server.Named"
                        , "Gargantext.API.Server.Named.EKG"
                        , "Gargantext.API.Server.Named.Ngrams"
                        , "Gargantext.API.Server.Named.Private"
                        , "Gargantext.API.Server.Named.Public"
                        , "Gargantext.API.Server.Named.Viz"
                        , "Gargantext.API.Swagger"
                        , "Gargantext.API.Table"
                        , "Gargantext.API.Table.Types"
                        , "Gargantext.API.ThrowAll"
                        , "Gargantext.Core.Ext.IMT"
                        , "Gargantext.Core.Ext.IMTUser"
                        , "Gargantext.Core.Flow.Ngrams"
                        , "Gargantext.Core.Flow.Types"
                        , "Gargantext.Core.Mail"
                        , "Gargantext.Core.Methods.Graph.MaxClique"
                        , "Gargantext.Core.Methods.Matrix.Accelerate.Utils"
                        , "Gargantext.Core.Methods.Similarities.Accelerate.Conditional"
                        , "Gargantext.Core.Methods.Similarities.Accelerate.Distributional"
                        , "Gargantext.Core.Methods.Similarities.Accelerate.SpeGen"
                        , "Gargantext.Core.Statistics"
                        , "Gargantext.Core.Text.Corpus.API.Hal"
                        , "Gargantext.Core.Text.Corpus.API.Isidore"
                        , "Gargantext.Core.Text.Corpus.API.Istex"
                        , "Gargantext.Core.Text.Corpus.Parsers.Date.Attoparsec"
                        , "Gargantext.Core.Text.Corpus.Parsers.FrameWrite"
                        , "Gargantext.Core.Text.Corpus.Parsers.GrandDebat"
                        , "Gargantext.Core.Text.Corpus.Parsers.Iramuteq"
                        , "Gargantext.Core.Text.Corpus.Parsers.Isidore"
                        , "Gargantext.Core.Text.Corpus.Parsers.JSON"
                        , "Gargantext.Core.Text.Corpus.Parsers.JSON.Istex"
                        , "Gargantext.Core.Text.Corpus.Parsers.RIS"
                        , "Gargantext.Core.Text.Corpus.Parsers.RIS.Presse"
                        , "Gargantext.Core.Text.Corpus.Parsers.WOS"
                        , "Gargantext.Core.Text.Learn"
                        , "Gargantext.Core.Text.List.Group"
                        , "Gargantext.Core.Text.List.Group.Prelude"
                        , "Gargantext.Core.Text.List.Group.WithScores"
                        , "Gargantext.Core.Text.List.Social.Find"
                        , "Gargantext.Core.Text.List.Social.Patch"
                        , "Gargantext.Core.Text.List.Social.Prelude"
                        , "Gargantext.Core.Text.Metrics.FrequentItemSet"
                        , "Gargantext.Core.Text.Metrics.SpeGen.IncExc"
                        , "Gargantext.Core.Text.Metrics.Utils"
                        , "Gargantext.Core.Text.Samples.DE"
                        , "Gargantext.Core.Text.Samples.EN"
                        , "Gargantext.Core.Text.Samples.ES"
                        , "Gargantext.Core.Text.Samples.FR"
                        , "Gargantext.Core.Text.Samples.PL"
                        , "Gargantext.Core.Text.Samples.ZH"
                        , "Gargantext.Core.Text.Terms.Mono.Token.En"
                        , "Gargantext.Core.Text.Terms.Multi.Group"
                        , "Gargantext.Core.Text.Terms.Multi.PosTagging"
                        , "Gargantext.Core.Text.Terms.Multi.PosTagging.Types"
                        , "Gargantext.Core.Types.Search"
                        , "Gargantext.Core.Utils.DateUtils"
                        , "Gargantext.Core.Viz"
                        , "Gargantext.Core.Viz.Chart"
                        , "Gargantext.Core.Viz.Graph.API"
                        , "Gargantext.Core.Viz.Graph.Bridgeness"
                        , "Gargantext.Core.Viz.Graph.FGL"
                        , "Gargantext.Core.Viz.Graph.GEXF"
                        , "Gargantext.Core.Viz.Graph.Legend"
                        , "Gargantext.Core.Viz.Graph.PatriciaTreeTypes"
                        , "Gargantext.Core.Viz.Graph.Tools.Infomap"
                        , "Gargantext.Core.Viz.Graph.Utils"
                        , "Gargantext.Core.Viz.LegacyPhylo"
                        , "Gargantext.Core.Viz.Phylo.Legacy.LegacyMain"
                        , "Gargantext.Core.Viz.Phylo.TemporalMatching"
                        , "Gargantext.Data.HashMap.Strict.Utils"
                        , "Gargantext.Database"
                        , "Gargantext.Database.Action.Delete"
                        , "Gargantext.Database.Action.Flow.Annuaire"
                        , "Gargantext.Database.Action.Flow.Extract"
                        , "Gargantext.Database.Action.Flow.List"
                        , "Gargantext.Database.Action.Flow.Pairing"
                        , "Gargantext.Database.Action.Flow.Utils"
                        , "Gargantext.Database.Action.Index"
                        , "Gargantext.Database.Action.Learn"
                        , "Gargantext.Database.Action.Mail"
                        , "Gargantext.Database.Action.Metrics"
                        , "Gargantext.Database.Action.Metrics.NgramsByContext"
                        , "Gargantext.Database.Action.Node"
                        , "Gargantext.Database.Action.Share"
                        , "Gargantext.Database.Admin.Access"
                        , "Gargantext.Database.Admin.Trigger.ContextNodeNgrams"
                        , "Gargantext.Database.Admin.Trigger.Contexts"
                        , "Gargantext.Database.Admin.Trigger.NodesContexts"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Any"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Contact"
                        , "Gargantext.Database.Admin.Types.Hyperdata.CorpusField"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Dashboard"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Default"
                        , "Gargantext.Database.Admin.Types.Hyperdata.File"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Frame"
                        , "Gargantext.Database.Admin.Types.Hyperdata.List"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Model"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Phylo"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Prelude"
                        , "Gargantext.Database.Admin.Types.Hyperdata.Texts"
                        , "Gargantext.Database.Admin.Types.Hyperdata.User"
                        , "Gargantext.Database.Admin.Types.Metrics"
                        , "Gargantext.Database.GargDB"
                        , "Gargantext.Database.Query"
                        , "Gargantext.Database.Query.Facet.Types"
                        , "Gargantext.Database.Query.Filter"
                        , "Gargantext.Database.Query.Join"
                        , "Gargantext.Database.Query.Prelude"
                        , "Gargantext.Database.Query.Table.Context"
                        , "Gargantext.Database.Query.Table.ContextNodeNgrams"
                        , "Gargantext.Database.Query.Table.ContextNodeNgrams2"
                        , "Gargantext.Database.Query.Table.Node.Children"
                        , "Gargantext.Database.Query.Table.Node.Contact"
                        , "Gargantext.Database.Query.Table.Node.Document.Add"
                        , "Gargantext.Database.Query.Table.Node.Document.Insert"
                        , "Gargantext.Database.Query.Table.Node.Select"
                        , "Gargantext.Database.Query.Table.Node.Update"
                        , "Gargantext.Database.Query.Table.Node.User"
                        , "Gargantext.Database.Query.Table.NodeContext"
                        , "Gargantext.Database.Query.Table.NodeContext_NodeContext"
                        , "Gargantext.Database.Query.Table.NodeNgrams"
                        , "Gargantext.Database.Query.Table.NodeNode"
                        , "Gargantext.Database.Query.Tree"
                        , "Gargantext.Database.Query.Tree.Error"
                        , "Gargantext.Database.Schema.Context"
                        , "Gargantext.Database.Schema.ContextNodeNgrams"
                        , "Gargantext.Database.Schema.ContextNodeNgrams2"
                        , "Gargantext.Database.Schema.NodeContext"
                        , "Gargantext.Database.Schema.NodeContext_NodeContext"
                        , "Gargantext.Database.Schema.NodeNgrams"
                        , "Gargantext.Database.Schema.NodeNode"
                        , "Gargantext.Database.Schema.Prelude"
                        , "Gargantext.Database.Types"
                        , "Gargantext.Utils.Aeson"
                        , "Gargantext.Utils.Servant"
                        , "Gargantext.Utils.UTCTime"
                        ]
:}

-- Define a command that loads all modules from the above list:
:def ggload const $ pure $ foldMap (\m -> "import " <> m <> "\n") gargantextModules