From 88a664f402ff1f84004b3ae5d7b93ac9c52a65b7 Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Fri, 20 Dec 2019 19:52:05 +0000 Subject: [PATCH] More tweaking of optics --- advent15/src/advent15optics.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/advent15/src/advent15optics.hs b/advent15/src/advent15optics.hs index d9a2f8c..777588e 100644 --- a/advent15/src/advent15optics.hs +++ b/advent15/src/advent15optics.hs @@ -114,9 +114,10 @@ searchHullDirection here (hull, boundary) direction where there = step here direction -- robot = _droid $ hull!here -- robot = fromJust $ preview (at here . _Just . isGoal) hull - robot = fromJust $ hull ^? at here . _Just . droid + -- robot = fromJust $ hull ^? at here . _Just . droid + robot = fromJust $ hull ^? ix here . droid -- distance = _fromStart $ hull!here - distance = fromJust $ hull ^? at here . _Just . fromStart + distance = fromJust $ hull ^? ix here . fromStart (robot', found) = runDroid robot direction -- newCell = Vacant { _droid = robot' -- , _fromStart = distance + 1 -- 2.34.1