Qualified Name Import Union Type

So, I have two types of union: JobStatus and TaskStatus .

 module Data.Job exposing (..) type JobStatus = Submitted | Started | Finished 

-

 module Data.Task exposing (..) type TaskStatus = Created | Running | Finished 

and I import them into the third module

 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 } 

But Finished too confusing, I want to write it as JobStatus.Finished or TaskStatus.Finished , how can I do this?

+5
source share
1 answer

if you changed your import from this

 import Data.Job as Job exposing (JobStatus(..)) import Data.Task as Task exposing (TaskStatus(..)) 

to that

 import Data.Job as Job import Data.Task as Task 

you can use Job.Finished and Task.Finished.

+8
source

Source: https://habr.com/ru/post/1276095/


All Articles