[<<][meta][>>][..]
Sun Jan 8 13:01:00 EST 2012

Still fundep problems

While working towards building SM modules, I run into a problem with:

  pdInfo n = _lambda $ \() -> _exit (n :: Tint)

  pdModule update minit = do
    _def "sm_init" $ pdInit minit
    _def "sm_tick" $ pdUpdate update

    _def "sm_state_size" $ pdInfo 100
  --  _def "sm_nb_init" $ pdInfo 100


If I add the uncommented line above, it doesn't infer: the
representations are not the same.  Adding fundeps in Data or Control
seems to fix things too much, i.e. something then fixes the
representation.

Hmm.. I don't get it.  This should really be straightforward: stx r m
are all uniquely related through the Loop constraint: one defines the
other 2, so anything that doesn't support this is a bug.

I fixed the Value rep's monad to MValue, which is currently just an
identity monad.

Looks like _lambda is wrong

  *Main> :t _lambda
  _lambda
    :: (DataWord s, StructVar Value.SValue sr, Struct Value s sr) =>
       (sr -> MValue (Value t)) -> MValue (Value (s -> MValue t))


Removing the code below, type is:

  _lambda
    :: (Control stx m r,
        DataWord s,
        StructVar stx sr,
        Struct r s sr) =>
       (sr -> m (r t)) -> m (r (s -> m t))


  niValue = "not implemented for Value representation"
  instance StructVar SValue t where
    structVar = error $ "StructVar" ++ niValue
  instance StructVarCons SValue where
    structVarCons = error $ "StructVarCons" ++ niValue
    structVarNil  = error $ "StructVarNil" ++ niValue


Replaced with, modeled after Code's instance

  niValue f = error $ f ++ " not implemented for Value representation"
  instance DataWord t 
           => StructVar SValue (L (Value t)) where
    structVar = niValue "StructVar"

  instance StructVarCons SValue where
    structVarCons = niValue "StructVarCons"
    structVarNil  = niValue "StructVarNil"







[Reply][About]
[<<][meta][>>][..]