Eta REPL already provides functionality for getting several bits of information about loaded source code, most of which is available
after running :set +c
.
:load
will do a-O0
compilation of the specified file and directly load the class files into the underlyingeta-serv
's JVM process's heap.
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:load
Implementation: https://github.com/typelead/eta/blob/master/eta/Eta/REPL/UI.hs#L1721-L1723
:reload
will detect any changes and recompile accordingly and only reload the transitively changed modules.
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:reload
Implementation: https://github.com/typelead/eta/blob/master/eta/Eta/REPL/UI.hs#L1802-L1807
:loc-at
command will, given a source span, provide the original definition site of the identifier in the source span.
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:loc-at
Implementation: https://github.com/typelead/eta/blob/master/eta/Eta/REPL/UI.hs#L2024-L2031
:all-types
will provide source spans mapped to types indicated a particular subexpression has the given type.
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:all-types
Implementation: https://github.com/typelead/eta/blob/master/eta/Eta/REPL/UI.hs#L2034-L2049
:type-at
will provide a type given a source span
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:all-types
Implementation: https://github.com/typelead/eta/blob/master/eta/Eta/REPL/UI.hs#L2003-L2011
:uses
will provide all the uses of given source span in the current module
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:uses
Implementation: https://github.com/typelead/eta/blob/master/eta/Eta/REPL/UI.hs#L2014-L2021
:info
will provide information like the type and the definition (if it exists)
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:info
Implementation: https://github.com/typelead/eta/blob/master/eta/Eta/REPL/UI.hs#L1423-L1431
:type
will provide the type the provided expression
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:type
Implementation: https://github.com/typelead/eta/blob/master/eta/Eta/REPL/UI.hs#L1993-L2000
:kind!
will provide the kind of the reduce type
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:kind
Implementation: https://github.com/typelead/eta/blob/master/eta/Eta/REPL/UI.hs#L2124-L2128
:browse
will list out all the exported functions/types of the given module
Documentation: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:browse