Fth*_*der 1 haskell module yesod
我有一个这样的模块:
module Model where
import FlowType
.
.
.
Run Code Online (Sandbox Code Playgroud)
我正在使用FlowTypeinModel的主体,但我也想与模型的函数 FlowType 一起导出。我找到了一个具有以下语法的模块:
module Import
( module Import
) where
import Foundation as Import
.
.
.
Run Code Online (Sandbox Code Playgroud)
这是什么module Import ( module Import) where???我如何在我的Model模块中做同样的事情(并导出它自己的函数)?
假设模块Foundation导出名称foo和bar.
首先,import Foundation as Import使可作为这些名称Import.foo和Import.bar当前所定义的模块内。
module然后该语句也导出这些名称。而不是必须写
module Import (foo, bar) where
Run Code Online (Sandbox Code Playgroud)
you can export everything accessible via the name Import with the syntax in the question. The example is a little confusing since it uses Import both as the internal name for Foundation and as the name of the current module. It would be more obvious written as
module Import (module Foundation) where
import Foundation
.
.
.
Run Code Online (Sandbox Code Playgroud)
In your case, you would write
module Model (module FlowType) where
import FlowType
Run Code Online (Sandbox Code Playgroud)
to export everything imported from FlowType from your module.