module FAM where
我不知道FAM做什么。所以我想获得一些有关它的信息。
通过使用:t
和:i
,我们将分别获得变量的类型和实例的信息。有什么方法可以获取模块信息?
答案 0 :(得分:1)
一个模块没有类型,它只导出声明。如果要查看导出的声明(以其他方式单击而不是已有的链接),则将模块加载到GHCi中并进行浏览。
例如,我将您的FAM模块保存在tmp目录中,因此可以将其加载到GHCi中:
% ghci /tmp/FAM.hs
GHCi, version 8.4.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /Users/tommd/.ghci
[1 of 1] Compiling FAM ( /tmp/FAM.hs, interpreted )
Ok, one module loaded.
*FAM>
现在,我可以通过浏览请求模块导出的声明,或者将模块保留为隐式(:browse
)或指定我感兴趣的模块(:browse FAM
),这在大于一个模块已加载。例如:
*FAM> :browse FAM
fmap_List :: (a -> b) -> [a] -> [b]
fmap_Maybe :: (a -> b) -> Maybe a -> Maybe b
fmap_Either :: (a -> b) -> Either e a -> Either e b
data BinTree a = BTNil | BTNode a (BinTree a) (BinTree a)
map2_List :: (a -> b -> c) -> [a] -> [b] -> [c]
map2_Maybe :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c
map2_Either ::
(a -> b -> c) -> Either e a -> Either e b -> Either e c
ap_List :: [a -> b] -> [a] -> [b]
map2_Listv2 :: (a -> b -> c) -> [a] -> [b] -> [c]
map3_List :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
addRecip :: Double -> Double -> Maybe Double
bind_Maybe :: Maybe a -> (a -> Maybe b) -> Maybe b
bind_Either :: Either e a -> (a -> Either e b) -> Either e b
bind_List :: [a] -> (a -> [b]) -> [b]
data IntranetRecord = I Integer String
data BBRecord = B Integer String
data MarkUsRecord = M String String
myJoin :: [IntranetRecord] -> [BBRecord] -> [MarkUsRecord]
myJoin2 :: [IntranetRecord] -> [BBRecord] -> [MarkUsRecord]
foldM :: Monad m => (b -> a -> m b) -> b -> [a] -> m b
newtype State s a = StateOf (s -> (s, a))
deState :: State s a -> s -> (s, a)
put :: s -> State s ()
get :: State s s
statefulSum :: [Integer] -> State Integer Integer
toyCheck :: IO Bool
class Monad f => MonadToyCheck (f :: * -> *) where
toyGetChar :: f Char
{-# MINIMAL toyGetChar #-}
toyCheck2 :: MonadToyCheck f => f Bool
realProgram :: IO Bool
newtype Feeder a = F (String -> (String, a))
unF :: Feeder a -> String -> (String, a)
testToyChecker2 :: String -> Bool
从这里,您可以检查模块导出的类型,类和函数。