I wanted to create haskell program that takes data stores on redis and prints it out on console. I was able to get stuff in and out of redis, but I am not really sure what is the best way to print it out to the console. I came up with the following code. Can you guys tell me if Im taking the right approach on this.-- So Im working with the redis library, hedis. -- I was able to store and retrive some json from redis. -- And, I go the following: --- Right (Just "theJson") -- So, I played around on ghci and I arrived at the following solution theJson = Right (Just "theJson") -- Stuff, I got from hedis somethingWentWrong _ = Just "Whoops, something went wrong" -- Return message if there's an error. -- Used by checkForError. checkForError = Data.Either.either somethingWentWrong id -- Look at the json. -- If its a Left (Just "theJson") throw a Whoops. -- If its a Right (Just "theJson") return Just "theJson" concatNothing = ( (++) "" ) -- take a string and return the string -- I think I need it for getJson. I want to unwrap Just "theJson" so I can get to "theJson" getJson mJson = maybe ("badJson") concatNothing mJson -- take the Just "theJson" -- If nothing, return "badJson" -- Just "theJson", return "theJson" showJson = show . getJson . checkForError showJson theJson submitted by tacit7
[link] [4 comments]
I am looking for a display function for 2,3,4 Tree in Haskell. I have all the other parts coded like search, addNode etc.
If anyone could help that would be great. My display is only on one line but I need to display it a tree like fashion.submitted by SmartBruteAttack
[link] [21 comments]