Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import Union type with a qualified name

Tags:

elm

So I have two union types: 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 a 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 is too confusing, I want to write it as JobStatus.Finished or TaskStatus.Finished how can I do that?

like image 312
BinaryHexer Avatar asked Mar 27 '18 04:03

BinaryHexer


Video Answer


1 Answers

if you changed your import from this

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

to this

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

you can use Job.Finished and Task.Finished.

like image 88
JosephStevens Avatar answered Oct 22 '22 14:10

JosephStevens