所以我有两种联合类型:JobStatus
和TaskStatus
。
module Data.Job exposing (..)
type JobStatus
= Submitted
| Started
| Finished
-
module Data.Task exposing (..)
type TaskStatus
= Created
| Running
| Finished
我将它们导入第三个模块
module Home exposing (..)
import Data.Job as Job exposing (JobStatus(..))
import Data.Task as Task exposing (TaskStatus(..))
type alias Model =
{ jobStatus : JobStatus
, taskStatus : TaskStatus
}
model : Model
model =
{ jobStatus = Finished
, taskStatus = Finished
}
但是Finished
太混乱了,我想把它写成JobStatus.Finished
或TaskStatus.Finished
我怎么能这样做?
答案 0 :(得分:9)
如果您从此
更改了导入import Data.Job as Job exposing (JobStatus(..))
import Data.Task as Task exposing (TaskStatus(..))
到这个
import Data.Job as Job
import Data.Task as Task
您可以使用Job.Finished和Task.Finished。