I am trying to split code into sub-packages of main file to make it easier
to read and more clear. Because I am making server calls with json-data I
have to create Values with encoders, which depend on current state-model.
-- Main.elm :
import Subpackage exposing (..)
-- MODEL
type alias Model =
{ search : String
, output : String
}
...some functions
-- Subpackage.elm :
module Subpackage exposing (..)
import Json.Encode exposing (..)
import Main exposing (..) -- not o.k.
buildQuery : Main.Model -> Json.Encode.Value
buildQuery model =
furtherCode ...
So, I hope the problem is seen. If I wrote the code as shown above I would
get an error, because I have created a loop with importing Subpackage in
Main.elm and Main.elm in Subpackage. Is there a way to actually achieve the
ability of Main.Module dependence in sub-packages or does the code have to
be written in the Main.elm file? How can I get the value of Model in
main-file to sub-packages?
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.