On Friday, December 30, 2016 at 1:48:31 PM UTC, Joey Eremondi wrote:
>
> 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.
>
Also you will have to specify the Team for a Player, but that Team will
need to list its Players, which will need to specify their Teams, and so
on... infinitely.
You could do:
type Player = Player { team : Maybe Team }
type Team = Team { players : Maybe List Player }
or some variant thereof. That would allow you to hold as much or as little
of the recursive relationship as you want to.
--
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.