You should be fine with File.SomeModule
. If anything I’d give a more accurate name instead of File
. E.g. your modules seem to deal with images specifically so a more helpful name might be File.Image
or ImageFile
or even Image
.
I also wouldn’t worry specifically about the elm/*
packages. It’s more of a general issue, like if you used elm-ui 1.1.8 then you wouldn’t be able to name any of your local modules Element
. I’d focus more on giving your modules names that make sense when you’re looking at the name along.
Exactly!
Which makes sense because a csv file is a specialized text file. If you open it in your text editor it’s still legible.
ImageSelected file ->
( model
, Task.perform (ImageLoaded (File.name file)) (File.toString file)
)
ImageLoaded filename content ->
( { model
| image = Just content
, imageName = filename
}
, Cmd.none
)
can be converted to
ImageSelected file ->
( { model | imageName = File.name file }
, Task.perform ImageLoaded (File.toString file)
)
ImageLoaded content ->
( { model
| image = Just content
}
, Cmd.none
)
there’s no need to pass the name through the message+update loop again (as best I can tell).
A small stylistic opinion. I’d merge all of your File_.*
modules into a single module. A module should generally be a container of sorts around a specific type. I’d also recommend Components | Elm Land for a very solid guide about how to model your component like modules.