我有一個這樣的導入:從其他文件哈斯克爾「進口資質」和「不在範圍:數據構造」
import qualified Bioinformatics.DNA as DNA
看起來像這樣:
data DNA = A | C | G | T
deriving (Eq, Ord, Show)
並在此功能在模塊RNA其中:
module Bioinformatics.RNA
(RNA
, fromDna
) where
import qualified Bioinformatics.DNA as DNA
data RNA = A | C | G | U
deriving (Eq, Ord, Show)
fromDna :: DNA.DNA -> RNA
fromDna DNA.A = A
fromDna DNA.C = C
fromDna DNA.G = G
fromDna DNA.T = U
我收到錯誤:
/home/thibaud/code/bioinformatics/src/Bioinformatics/RNA.hs:46:9:
Not in scope: data constructor ‘DNA.A’
/home/thibaud/code/bioinformatics/src/Bioinformatics/RNA.hs:47:9:
Not in scope: data constructor ‘DNA.C’
/home/thibaud/code/bioinformatics/src/Bioinformatics/RNA.hs:48:9:
Not in scope: data constructor ‘DNA.G’
/home/thibaud/code/bioinformatics/src/Bioinformatics/RNA.hs:49:9:
Not in scope: data constructor ‘DNA.T’
你有一個想法,爲什麼? 感謝
您可能不需要'數據A; ...;數據T'類型定義。值構造函數就足夠了,只要您按照下面的答案中指出的那樣導出和導入它們即可。 – chi