I’m trying to organize my Lamdera app’s codebase similar to GitHub - supermario/lamdera-realworld: Lamdera port of elm-spa realworld implementation, adding a full backend implementation..
type alias ToBackend =
In Pages/Home.elm, in
update, I’m trying to return this:
, Lamdera.sendToBackend Foo
But i get a cumpiler error. It says that
Foo is a
Bridge.ToBackend value, but
sendToBackend needs it to be
Just on the off-chance, are you sure you’ve got the latest compiler? The bridge alias trick is a more recent feature to allow breaking import cycles.
Short of that I’m not 100% sure what the issue is, are you modifying lamdera-realworld or trying to replicate it from scratch? If the latter, am I able to see your source somewhere? Might be easier to spot the issue in full context
Here is an SSCCE (relevant parts of my code).
Main/Test.elm is a module with the type mismatch error.
@DullBananas great, thank you!
So the issue is you’ve used
Main/Bridge.elm instead of
Bridge.elm. If you change the module name and fix up the imports, it should compile!
Right now core type placements are special cased in the compiler and expected to be very specifically named. Perhaps in future this could be cleverer and detect intent based on usage, but right now
Bridge.elm are special and should be the modules used.
Let me know if you get stuck on anything else!
add that to Lamdera’s documentation
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.