从模块重新导出功能

时间:2018-06-25 14:20:00

标签: haskell

我有一个像这样的模块

module A where

import qualified Data.Maybe as Maybe

fromMaybe = Maybe.fromMaybe

是否可以仅从Data.Maybe中重新导出某些功能?我不想重新导出整个Data.Maybe模块,而只是重新导出某些功能,例如fromMaybe

1 个答案:

答案 0 :(得分:6)

是的,您可以有选择地重新导出功能:

module A (
  module A,
  Maybe.fromMaybe ) where 

import qualified Data.Maybe as Maybe

模块定义后()中的片段定义了要导出的内容。这里我们说“将所有module A连同函数Maybe.fromMaybe一起导出。”