Copyright | (c) Eric Mertens 2019 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | Safe |
Language | Haskell2010 |
This module provides a representation of the intcode machine's opcodes.
Opcodes are parameterized over their parameters. This allows the implementation to store both parameter modes and resolved parameter pointers in the same constructors.
Types
Opcodes parameterized over argument representations.
Add !a !a !a | addition: |
Mul !a !a !a | multiplication: |
Inp !a | input: |
Out !a | output: |
Jnz !a !a | jump-if-true: |
Jz !a !a | jump-if-false: |
Lt !a !a !a | less-than: |
Eq !a !a !a | equals: |
Arb !a | adjust-rel-base: |
Hlt | halt |
Instances
Functor Opcode Source # | |
Foldable Opcode Source # | |
Defined in Intcode.Opcode fold :: Monoid m => Opcode m -> m # foldMap :: Monoid m => (a -> m) -> Opcode a -> m # foldMap' :: Monoid m => (a -> m) -> Opcode a -> m # foldr :: (a -> b -> b) -> b -> Opcode a -> b # foldr' :: (a -> b -> b) -> b -> Opcode a -> b # foldl :: (b -> a -> b) -> b -> Opcode a -> b # foldl' :: (b -> a -> b) -> b -> Opcode a -> b # foldr1 :: (a -> a -> a) -> Opcode a -> a # foldl1 :: (a -> a -> a) -> Opcode a -> a # elem :: Eq a => a -> Opcode a -> Bool # maximum :: Ord a => Opcode a -> a # minimum :: Ord a => Opcode a -> a # | |
Traversable Opcode Source # | Arguments visited from left to right. |
Read a => Read (Opcode a) Source # | |
Show a => Show (Opcode a) Source # | |
Eq a => Eq (Opcode a) Source # | |
Ord a => Ord (Opcode a) Source # | |
Defined in Intcode.Opcode |