So, I have a project which, it seems to me, is simple enough to learn, but complex enough to be interesting, what I would like to write using the Happstack library. At this very fundamental level, this project will be just a fancy file server with some REST methods for a specific domain (or something else, I donβt care whether it is RESTful or not) to search and retrieve the specified files and metadata. Since I am also trying to really learn monad transformers right now, I decided that it would be a great project to learn from. However, I encountered some difficulties when it started, especially with how to build my transformer stack.
Currently, only a few things bother me: the config, error report and status, as well as logging, so I started with
newtype MyApp a = MyApp { runMyApp :: ReaderT Config (ErrorT String (StateT AppState IO)) a } deriving (...)
Since I will always be in IO, I can easily use hslogger to do this to take care of my logging. But I also knew that I needed to use ServerPartT to interact with Happstack, this way
runMyApp :: ReaderT Config (ErrorT String (StateT AppState (ServerPartT IO))) a
I can get this to run, see requests, etc., but the problem I am facing is that it requires FilterMonad to use methods like dir , path and ok , but I have no idea how implement it for this type. I just need to pass the filters down to the main monad. Can someone give me some guidance on how to implement this obviously important class of types? Or, if I'm just doing something terrible, just direct me in the right direction. I only looked at Happstack for a few days, and the transformers are still new to me. I think I understand them enough to be dangerous, but I donβt know enough about them so that I can implement it myself. Any help you can provide is greatly appreciated!
FULL CODE
(X-sent from / r / haskell )