You need to use type, not type alias, for mutual recursion. Type aliases are just ways to give a type a new name, and are expanded in the compiler, which would not terminate if recursion was allowed.
On Dec 30, 2016 7:39 AM, "Marco Perone" <[email protected]> wrote: You're right! Sorry for the dumb question... I need to use something like type alias Player = { ... , team : TeamId } 2016-12-30 14:17 GMT+01:00 Cristian Garcia <[email protected]>: > Is it even posible to have such a type in the Elm type system? I dont > think you can call this type recursive, it looks like an infinite type. > > On Fri, Dec 30, 2016, 03:29 Marco Perone <[email protected]> wrote: > >> I have two types >> >> type alias Player = >> { ... >> , team : Team >> } >> >> type alias Team = >> { ... >> , players : List Players >> } >> >> which clearly have a circular dependency. I am duplicating data and I am >> doing that on purpose. >> >> Now the question is: is it possible is some way to have these two types >> in different modules/files? Or must I have them in the same module/file to >> avoid circular dependencies? >> >> -- >> 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. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Elm Discuss" group. > To unsubscribe from this topic, visit https://groups.google.com/d/to > pic/elm-discuss/si6DOd-rol8/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > > For more options, visit https://groups.google.com/d/optout. > -- 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. -- 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.
