From: Neil Smith Date: Fri, 20 Dec 2019 19:52:05 +0000 (+0000) Subject: More tweaking of optics X-Git-Url: https://git.njae.me.uk/?p=advent-of-code-19.git;a=commitdiff_plain;h=88a664f402ff1f84004b3ae5d7b93ac9c52a65b7 More tweaking of optics --- 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