-- wall type for different wall tiles
wallType :: DLevel -> Point -> Maybe WallType
wallType lvl p =
    if not (maybe False isWall (findTileAt p lvl)) then Nothing
    else if wallN lvl p && wallS lvl p && wallE lvl p && wallW lvl p then Just WallNESW
    else if wallN lvl p && wallS lvl p && wallE lvl p then Just WallNSE
    else if wallN lvl p && wallS lvl p && wallW lvl p then Just WallNSW
    else if wallN lvl p && wallW lvl p && wallE lvl p then Just WallNEW
    else if wallS lvl p && wallW lvl p && wallE lvl p then Just WallSEW
    else if wallN lvl p && wallS lvl p then Just WallNS
    else if wallW lvl p && wallS lvl p then Just WallSW
    else if wallE lvl p && wallS lvl p then Just WallSE
    else if wallW lvl p && wallN lvl p then Just WallNW
    else if wallE lvl p && wallN lvl p then Just WallNE
    else if wallE lvl p then Just WallEW
    else if wallW lvl p then Just WallEW
    else if wallS lvl p then Just WallNS
    else if wallN lvl p then Just WallNS
    else Just Wall
wallType :: DLevel -> Point -> Maybe WallType
wallType lvl p =
    if not (maybe False isWall (findTileAt p lvl)) then Nothing
    else if wallN lvl p && wallS lvl p && wallE lvl p && wallW lvl p then Just WallNESW
    else if wallN lvl p && wallS lvl p && wallE lvl p then Just WallNSE
    else if wallN lvl p && wallS lvl p && wallW lvl p then Just WallNSW
    else if wallN lvl p && wallW lvl p && wallE lvl p then Just WallNEW
    else if wallS lvl p && wallW lvl p && wallE lvl p then Just WallSEW
    else if wallN lvl p && wallS lvl p then Just WallNS
    else if wallW lvl p && wallS lvl p then Just WallSW
    else if wallE lvl p && wallS lvl p then Just WallSE
    else if wallW lvl p && wallN lvl p then Just WallNW
    else if wallE lvl p && wallN lvl p then Just WallNE
    else if wallE lvl p then Just WallEW
    else if wallW lvl p then Just WallEW
    else if wallS lvl p then Just WallNS
    else if wallN lvl p then Just WallNS
    else Just Wall
wallType lvl p =
    if not (maybe False isWall (findTileAt p lvl)) then Nothing
    else if wallN lvl p && wallS lvl p && wallE lvl p && wallW lvl p then Just WallNESW
    else if wallN lvl p && wallS lvl p && wallE lvl p then Just WallNSE
    else if wallN lvl p && wallS lvl p && wallW lvl p then Just WallNSW
    else if wallN lvl p && wallW lvl p && wallE lvl p then Just WallNEW
    else if wallS lvl p && wallW lvl p && wallE lvl p then Just WallSEW
    else if wallN lvl p && wallS lvl p then Just WallNS
    else if wallW lvl p && wallS lvl p then Just WallSW
    else if wallE lvl p && wallS lvl p then Just WallSE
    else if wallW lvl p && wallN lvl p then Just WallNW
    else if wallE lvl p && wallN lvl p then Just WallNE
    else if wallE lvl p then Just WallEW
    else if wallW lvl p then Just WallEW
    else if wallS lvl p then Just WallNS
    else if wallN lvl p then Just WallNS
    else Just Wall