so i took a look .. (also the inline-r devs seem to have done a hackage revision so you wont hit that issue in your current setup if you do a cabal update ..)
and it seems like the type definitions in inline-r are kinda bogus and you should get them patched ...
the MVector type class, and related type families, all assume your mutable type has the last two arguments as the io/state token and then the element type
eg
as a point of grounding this chat
the injective type familly in question is defined by the follwoing
#if MIN_VERSION_base(4,9,0)
type family Mutable (v :: * -> *) = (mv :: * -> * -> *) | mv -> v
#else
type family Mutable (v :: * -> *) :: * -> * -> *
#endif
anyways, it looks like the Pure / immutable vector data type in inline-r has a spurious state token argument in its definition that shouldn't be there, OR there need to be two "s" params in inline-r instead of the one
heres the full code i linked to in question
-- | Mutable R vector. Represented in memory with the same header as 'SEXP' |
-- nodes. The second type parameter is phantom, reflecting at the type level the -- tag of the vector when viewed as a 'SEXP'. The tag of the vector and the -- representation type are related via 'ElemRep'. data MVector s ty a = MVector { mvectorBase :: {-# UNPACK #-} !(SEXP s ty) , mvectorOffset :: {-# UNPACK #-} !Int32 , mvectorLength :: {-# UNPACK #-} !Int32 } -- | Internal wrapper type for reflection. First type parameter is the reified -- type to reflect. newtype W t ty s a = W { unW :: MVector s ty a } instance (Reifies t (AcquireIO s), VECTOR s ty a) => G.MVector (W t ty) a where
| |
|
data Vector s (ty :: SEXPTYPE) a = Vector |
{ vectorBase :: {-# UNPACK #-} !(ForeignSEXP ty) , vectorOffset :: {-# UNPACK #-} !Int32 , vectorLength :: {-# UNPACK #-} !Int32
| |
| } |
|
type instance G.Mutable (W t ty s) = Mutable.W t ty
|
Anyways, the fix here is to remove the s param from the Pure version of W and "Sexp Vector"