Created
June 2, 2021 17:56
-
-
Save guibou/813c278ca5ca72e4fa0d84d75e5324ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| import Data.Word | |
| data family Address arch | |
| type family InterpreterState arch | |
| type family State arch :: (* -> *) -> * | |
| data instance Address Int = AddressInt Int | |
| data instance Address Char = AddressChar Word8 Word8 Word8 Word8 | |
| class Mem8 arch where | |
| store :: Address arch -> f Word8 -> State arch f -> State arch f | |
| load :: Address arch -> State arch f -> Maybe (f Word8) | |
| localhost = AddressChar 127 0 0 1 | |
| localhost' = AddressInt 0xff000001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment