Might it also be quicker to put the Parent -> Child link in the Child 
element? That way you avoid Lists in your definition

type alias Parent =
    { id: Int
    , title: String
    }

type alias Child =
    { id: Int
    , title: String
    , ancestor: Parent
    }

A further step could be to combine Parent and Child into a single type 
alias 'Person', allowing for the possibility that some 'Person' s do not 
have parents

type alias Person =
    { id: Int
    , title: String
    , ancestor: Maybe Person
    }

If that fails with a recursive type error (does it?), then you could simply 
link to the id of the parent

type alias Person =
    { id: Int
    , title: String
    , ancestorID: Maybe Int
    }




-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to