Recursive type definition

How to do this in Elm?

If I understand what’s being modeled correctly, I think it could be written in Elm like:

type alias Details =
    { name : String
    , description : String
    }


type alias Item =
    { details : Details }


type Exit
    = PassableExit Details Room
    | LockedExit Details Item Exit
    | NoExit (Maybe Details)


type alias Exits =
    { north : Exit
    , south : Exit
    , east : Exit
    , west : Exit
    }


type alias Room =
    { details : Details
    , items : List Item
    , exits : Exits
    }
2 Likes

Thanks a lot!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.