aoc2017-0.1.0.0: Advent of Code 2017 - my answers

Safe HaskellNone
LanguageHaskell2010

Day23

Description

 

Synopsis

Documentation

data Ins reg imm Source #

A single instruction.

Either represents either a register reference or an immediate value.

Constructors

Set 

Fields

Sub 

Fields

Mul 

Fields

Jnz 

Fields

data State a reg imm Source #

The current state of a machine.

Constructors

State 

Fields

parseVal :: Read imm => String -> Either Char imm Source #

Parses an immediate value or a single character register name.

parse :: Read imm => String -> [Ins Char imm] Source #

Parses an assembly listing to instructions.

step :: (IArray a imm, Ix reg, Integral imm) => [Ins reg imm] -> State a reg imm -> Maybe (State a reg imm) Source #

Evaluates a single instruction.

stepOptimized :: (IArray a imm, Ix reg, Integral imm) => [Ins reg imm] -> State a reg imm -> Maybe (State a reg imm) Source #

Evaluates the f = 0 if !isPrime(b) sequence, or a single instruction.

iterateMaybe :: (a -> Maybe a) -> Maybe a -> [a] Source #

Iterates a function until Nothing.