Skip to content

Instantly share code, notes, and snippets.

@joshcough
Created October 12, 2014 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcough/ed53aed90353e233522c to your computer and use it in GitHub Desktop.
Save joshcough/ed53aed90353e233522c to your computer and use it in GitHub Desktop.
src/L/Computer.hs:163:23:
Could not deduce (m ~ ErrorT Halt m0)
from the context (MonadError Halt m,
MonadState c m,
HasComputer c a)
bound by the type signature for
readMem :: (MonadError Halt m, MonadState c m, HasComputer c a) =>
String -> Int64 -> m Int64
at src/L/Computer.hs:162:12-93
‘m’ is a rigid type variable bound by
the type signature for
readMem :: (MonadError Halt m, MonadState c m, HasComputer c a) =>
String -> Int64 -> m Int64
at src/L/Computer.hs:162:12
Expected type: m Int64
Actual type: ErrorT Halt m0 Int64
Relevant bindings include
go :: ErrorT Halt m0 Int64 (bound at src/L/Computer.hs:165:3)
readMem :: String -> Int64 -> m Int64
(bound at src/L/Computer.hs:163:1)
In the expression: go
In an equation for ‘readMem’:
readMem caller addr
= go
where
index = fromIntegral addr `div` 8
go
| index < memSize = use $ singular $ memory . ix index
| otherwise
= exception
$ caller
++ "tried to access out of bounds memory index: " ++ show index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment