gpt4 book ai didi

elm - 导入具有限定名称的联合类型

转载 作者:行者123 更新时间:2023-12-04 14:08:48 26 4
gpt4 key购买 nike

所以我有两种联合类型:JobStatusTaskStatus .

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.FinishedTaskStatus.Finished我怎样才能做到这一点?

最佳答案

如果您从此更改了导入

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。

关于elm - 导入具有限定名称的联合类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49504258/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com