Polymorphic functions are indeed not allowed. This is due to the
design of HAppS and cannot change. It is unfortunately not possible to
deserialise polymorphic values.
It should, however, be noted that a certain level of polymorphism is
allowed. That is, components can have all the type variables they
want. So this is allowed:
> method :: a -> Update (Component a) ()
but this isn't:
> method :: a -> Update Component ()
--
Cheers,
Lemmih
Server error: Emitted event to unknown component. Ev: Main.TestQuery [Char]
I guess this means that it can't link the query to the proper component,
but I'm not sure how to fix this. I'm sure there is a fix, or you
wouldn't have suggested it. Below is some of the code I used:
instance (Serialize a) => Component (CMap a) where
type Dependencies (CMap a) = End
initialValue = empty
instance Component (CMap String) where
type Dependencies (CMap String) = End
initialValue = empty
testQuery :: Query (CMap a) (CMap a)
testQuery = ask
testAdd x = modify (add (const x))
$(mkMethods ''CMap ['testQuery, 'testAdd])
controller :: [ServerPart Response]
controller = [
dir "list" [anyRequest $ liftM (toResponse . show) $ (webQuery
TestQuery :: Web (CMap String))],
dir "add" [anyRequest $ liftM (toResponse . show) $ (webUpdate $
TestAdd "hello")]
]
Note that I tried the instances of Component in all combinations.
What am I doing wrong, and how can I fix it?
Did you start the HAppS state system? That is, did you call
'startStateSystem' and, if so, which entry point did you use?
--
Cheers,
Lemmih