TZ
Size: a a a
TZ
TZ
AF
AP
MK
JJ

MK
JJ
Could not deduce (Storable a0) arising from a use of ‘sizeOf’
from the context: Storable a
bound by the type signature for:
readMem :: forall a.
Storable a =>
Word32 -> ReaderT (PHANDLE, ForeignAddress) IO a
at C:\Users\jakow\Documents\Programming\cshs\src\GameAPI.hs:21:1-73
The type variable ‘a0’ is ambiguous
These potential instances exist:
instance Storable Word32 -- Defined in ‘Foreign.Storable’
instance Storable () -- Defined in ‘Foreign.Storable’
instance Storable Bool -- Defined in ‘Foreign.Storable’
...plus five others
...plus 82 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the second argument of ‘($)’, namely ‘sizeOf (t :: a)’
In the second argument of ‘($)’, namely
‘readProcessMemory pHandle address $ sizeOf (t :: a)’
In a stmt of a 'do' block:
ptr <- liftIO $ readProcessMemory pHandle address $ sizeOf (t :: a)
MK
JJ
MK
IO
forall и если не включен ScopedTypeVariables. Соответственно у Вас a в теле - новая, никак не связанная со старой a переменная (поэтому ghc называет ее a0 в сообщении об ошибке), для которой Storable не выполнен - вот и все.MK
к
ScopedTypeVariables можно просто на два экстеншена разбить, один именно дает добавлять типопеременные в скоуп, а другой лифтит типопеременные из forall сигнатуры в скоуп определенияVL