I have a moderately sized application that uses Data.Acid for persistence and I've encountered a situation where I need to update the implementation of one of my Update events for the next version of the server. I.e. I have something like
myUpdate…
I'm using acid-state in a project and I quite like it. I like how easy it is to add persistence to plain Haskell datatypes without much boilerplate.
As far as I understand, acid-state keeps a log of events, instead of writing out the entire new…
data Foo = Foo {
_bar :: Map String Integer
} deriving (Eq, Ord, Read, Show, Data, Typeable)
$(deriveSafeCopy 0 'base 'Foo)
$(makeLenses ''Foo)
Given the above code I am under the impression that it should be possible to do this:
addEntry ::…
It would be nice to be able to use the Network.WebSockets module from inside a snaplet, but I can't figure out how to actually do it.
Using the runWebSocketsSnap :: MonadSnap m => ServerApp -> m () function from Network.WebSockets.Snap it is easy to…
I'm trying acid-state. The documentation states that Update st is an instance of MonadState st. I tried different things, but my compiler doesn't want to see that :( I tried the HelloWorld.hs from examples, but got the same…
I am writing a web service in haskell using warp, wai, and acid-state. As of now, I have two handler functions that require database interaction, the latter of which is giving me trouble.
The first, is registration:
registerUser :: AcidState…
Current state
I have two data types.
data Foo = Foo
{ fooId :: RecordId Foo
, bars :: [RecordId Bar]
...
}
data Bar = Bar
{ barId :: RecordId Bar
...
}
This schema allows for each Foo to refer to an arbitrary list of Bars.…
insertST :: StateDecoder -> SomeState -> Update SomeState SomeThing
insertST stDecoder st = ...
the stuff in StateDecoder can't be used in
$(makeAcidic ''SomeState ['insertST])
but if I declare a state and wrap it like this ...
myDecoder ::…
I'm trying to extend Happstack crash course blog with some additional functionality: displaying a list of all tags on home page.
My blog record looks like this:
data Blog = Blog
{ nextPostId :: PostId
, posts :: IxSet Post
, allTags…
I have a file structure like this:
--- Database.hs ---
data Database = ...
...
--- User.hs ---
import Database
addUser :: Update Database ()
...
--- Post.hs
import Database
addPost :: Update Database ()
...
The problem is that I need to called…
I'm a newbie to Haskell, and wanted to try the acid-state library, but I get the following output when trying to install it:
>cabal install acid-state
Resolving dependencies...
Configuring acid-state-0.7.5...
Building…
I am strugging with grouping sequences of events into one atomic transaction.
Consider a Map stored in acid-state, and imagine you want to implement Data.Map.alter. The function that takes a maybe-value and returns one cannot be stored in the…
I've got a situation in a Haskell web project where I'm getting the error Ambiguous type variable.
The relevant code is
--- Other import statements
import qualified Model as Model
---------- HTTP Handlers
needItem db user itemName = do
…
In acid-state tutorial all the examples use Template Haskell. However, due to some reasons I am not very keen on using it.
I know one can use acid-state without template haskell, as shown…
i'm a haskell noob and have problems with testing functions with acid-states.This ist my Datastructure
data UserState = UserState { name :: String }
deriving (Eq, Ord, Read, Show, Data, Typeable)
and this is the function i want to test:
setName…