So I'm trying to update my app to use 0.5.1 version of happstack-foundation but I've come across the following error.
As I think is necessary, I've changed my type aliases to refer to (AcidState MyAppState) instead of MyAppState, like such:
type MyApp' = FoundationT' Route (AcidState MyAppState) () IO
type MyApp = XMLGenT MyApp'
but I'm getting this:
src/MyApp/Web/Pages/Common.hs:71:27:
Overlapping instances for HasAcidState
(XMLGenT
(RouteT
Route
(StateT
(Happstack.Foundation.AppState
Route (AcidState MyApp.Model.MyAppState) ())
(ServerPartT IO))))
MyApp.Model.MyAppState
arising from a use of `query'
Matching instances:
instance (Functor m, Monad m) =>
HasAcidState
(FoundationT url (AcidState acidState) requestState m) acidState
-- Defined in `Happstack.Foundation'
instance HasAcidState (FoundationT' url acid reqSt m) acidSt =>
HasAcidState (XMLGenT (FoundationT' url acid reqSt m)) acidSt
-- Defined in `Happstack.Foundation'
In a stmt of a 'do' block: mUser <- query GetUser
In the expression:
do { here <- whereami;
mUser <- query GetUser;
(genElement
(Nothing, fromStringLit "html")
[asAttr (fromStringLit "lang" := MsgLang)]
[asChild ((genElement (Nothing, fromStringLit "head") [] [...])),
asChild ((genElement (Nothing, fromStringLit "body") [] [...]))]) }
In an equation for `myAppHTML':
myAppHTML
= do { here <- whereami;
mUser <- query GetUser;
.... }
cabal: Error: some packages failed to install:
myapp-0.1.0.3 failed during the building phase. The exception was:
ExitFailure 1
Commenting out the new instance seems to fix it, but I can't really see why it's getting confused since this should be a different type.
pdr@home:code/happstack/happstack-foundation$ darcs diff
diff -rN -u old-happstack/happstack-foundation/Happstack/Foundation.hs new-happstack/happstack-foundation/Happstack/Foundation.hs
--- old-happstack/happstack-foundation/Happstack/Foundation.hs 2013-10-22 15:36:50.336812563 +0200
+++ new-happstack/happstack-foundation/Happstack/Foundation.hs 2013-10-22 15:36:51.740812586 +0200
@@ -99,8 +99,8 @@
getAcidState :: m (AcidState st)
-instance (HasAcidState (FoundationT' url acid reqSt m) acidSt) => HasAcidState (XMLGenT (FoundationT' url acid reqSt m)) acidSt where
- getAcidState = XMLGenT getAcidState
+-- instance (HasAcidState (FoundationT' url acid reqSt m) acidSt) => HasAcidState (XMLGenT (FoundationT' url acid reqSt m)) acidSt where
+-- getAcidState = XMLGenT getAcidState
getAcidSt :: (Functor m, MonadState (AppState url acidState requestState) m) => m acidState
So that seems to work, but I'm also now getting thread hangs, probably from acid-state but I'll send a separate post about that since I'm still trying to fix it or at least isolate the cause.
By the way, I tried simply downgrading to foundation 0.4 again, but then acid-state 0.11.4 failed to compile with this error:
$ cabal install acid-state-0.11.4
Resolving dependencies...
Configuring acid-state-0.11.4...
Building acid-state-0.11.4...
Preprocessing library acid-state-0.11.4...
[ 1 of 15] Compiling Data.Acid.CRC ( src/Data/Acid/CRC.hs, dist/build/Data/Acid/CRC.o )
[ 2 of 15] Compiling Paths_acid_state ( dist/build/autogen/Paths_acid_state.hs, dist/build/Paths_acid_state.o )
[ 3 of 15] Compiling Data.Acid.Archive ( src/Data/Acid/Archive.hs, dist/build/Data/Acid/Archive.o )
src/Data/Acid/Archive.hs:65:19:
Constructor `Serialize.Fail' should have 2 arguments, but has been given 1
In the pattern: Serialize.Fail msg
In a case alternative: Serialize.Fail msg -> Fail msg
In the expression:
case result of {
Serialize.Done entry rest
| Strict.null rest -> Next entry (worker more)
| otherwise -> Next entry (worker (rest : more))
Serialize.Fail msg -> Fail msg
Serialize.Partial cont
-> case more of {
[] -> check (cont Strict.empty) []
(x : xs) -> check (cont x) xs } }
cabal: Error: some packages failed to install:
acid-state-0.11.4 failed during the building phase. The exception was:
ExitFailure 1
This is all from a fresh cabal, built using:
# remove ~/.cabal and ~/.ghc directories
cabal update
cabal install mtl bytestring directory
cabal install hsx2hs
cabal install regex-posix regex-compat regex-base --force-reinstalls
cabal install data-default time-compat nats transformers-base split primitive semigroups base-unicode-symbols lifted-base resourcet stm mmorph vector hscolour text ixset hlint certificate shakespeare-i18n shakespeare hslogger happstack-server happstack-foundation happstack-hsp happstack certificate tls-extra tls fast-logger monad-logger conduit zlib-conduit xml-conduit acid-state SHA pwstore-purehaskell
Cheers,
Pete