私のデータベースは、アイテムのテーブルと関連する広告のテーブルで構成されています。Elmのモデリング関連が依存関係のサイクルにつながる
私のelmアプリには、関連する広告を含むアイテム、または親アイテムに関する情報を含む広告が表示されます。
module Item.Model exposing (..)
import Ad.Model exposing (Ad)
type alias Item =
{ ads : Maybe List Ad
}
と
module Ad.Model exposing (..)
import Item.Model exposing (Item)
type alias Ad =
{ item : Maybe Item
}
をこの定義は、しかし、その結果:これらのインタフェースのニーズに合うように
、私は私のAPIがすでに送信どのようなマッチング、ニレ、次の2つのモジュールを書くことが好きだろう次の依存関係サイクルエラー:
ERROR in ./elm-admin/Main.elm
Module build failed: Error: Compiler process exited with error Compilation failed
Your dependencies form a cycle:
┌─────┐
│ Item.Model
│ ↓
│ Ad.Model
└─────┘
You may need to move some values to a new module to get rid of the cycle.
at ChildProcess.<anonymous> (/opt/app/assets/node_modules/node-elm-compiler/index.js:141:27)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:886:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
@ ./js/admin.js 3:12-44
同じモジュール内にtype alias
を定義してもコンパイラは停止しませんが、これは私のアプリケーションのすべてModel
が同じファイルになることを望まないため、私にとって満足のいく解決策ではありません。
同じモジュール内に2種類のエイリアスAd
とItem
を定義しないと解決できますか?
完全性のためにエラーメッセージを追加してください – ZhekaKozlov
私は完全なエラーメッセージ – AlexHv