never executed always true always false
1 module HelVM.HelMA.Automata.Piet.Types.InstructionCounter
2 ( InstructionCounter (..)
3 , codelChooserIC
4 , directionPointerIC
5 , initialInstructionCounter
6 , orientation
7 , position
8 , rotateDirectionPointerIC
9 , toggleCodelChooserIC
10 ) where
11
12 import HelVM.HelMA.Automata.Piet.Types.CodelChooser
13 import HelVM.HelMA.Automata.Piet.Types.Coordinates
14 import HelVM.HelMA.Automata.Piet.Types.DirectionPointer
15 import HelVM.HelMA.Automata.Piet.Types.Orientation
16
17 import Lens.Micro ( (%~), (^.) )
18 import Lens.Micro.TH ( makeLenses )
19
20 data InstructionCounter
21 = InstructionCounter
22 { _position :: !Coordinates
23 , _orientation :: !Orientation
24 }
25
26 makeLenses ''InstructionCounter
27
28 directionPointerIC ∷ InstructionCounter → DirectionPointer
29 directionPointerIC ic = ic ^. (orientation . directionPointer)
30
31 codelChooserIC ∷ InstructionCounter → CodelChooser
32 codelChooserIC ic = ic ^. (orientation . codelChooser)
33
34 rotateDirectionPointerIC ∷ Int → InstructionCounter → InstructionCounter
35 rotateDirectionPointerIC n = orientation %~ rotateDirectionPointer n
36
37 toggleCodelChooserIC ∷ Int → InstructionCounter → InstructionCounter
38 toggleCodelChooserIC n = orientation %~ toggleCodelChooser n
39
40 initialInstructionCounter ∷ InstructionCounter
41 initialInstructionCounter = InstructionCounter initialCoordinates initialOrientation