Is there a way to view a list of Prelude functions from the Haskell console?
Asked Answered
V

1

7

Is there a way to view a list of Prelude functions (such as Data.Char) from the Haskell console, instead of visiting Hoogle?

Versus answered 2/1, 2013 at 18:5 Comment(1)
Note, Data.Char is a module in the base package. Not a Prelude function.Qualification
Q
10

From GHCi you can use

:browse Data.Char

to see the types and values exported by a given module.

E.g.

Prelude> :browse Data.Char
digitToInt :: Char -> Int
generalCategory :: Char -> GeneralCategory
isLetter :: Char -> Bool
isMark :: Char -> Bool
isNumber :: Char -> Bool
isPunctuation :: Char -> Bool
isSeparator :: Char -> Bool
isSymbol :: Char -> Bool
data Char = GHC.Types.C# GHC.Prim.Char#
chr :: Int -> Char
...
Qualification answered 2/1, 2013 at 18:22 Comment(2)
...so you can see everything in the prelude with: :browse Prelude.Void
Also, there's ghc-pkg describe base (for example) to list modules in package base.Cupule

© 2022 - 2024 — McMap. All rights reserved.