News aggregator

Newb Question: Am I taking the right approach to working with 'Right (Just "someString")'

Haskell on Reddit - Thu, 12/11/2014 - 2:39pm

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]
Categories: Incoming News

An ASM Monad

Haskell on Reddit - Thu, 12/11/2014 - 12:30pm
Categories: Incoming News

blog.feabhas.com

del.icio.us/haskell - Thu, 12/11/2014 - 12:22pm
Categories: Offsite Blogs

gist.github.com

del.icio.us/haskell - Thu, 12/11/2014 - 12:22pm
Categories: Offsite Blogs

blog.feabhas.com

del.icio.us/haskell - Thu, 12/11/2014 - 12:22pm
Categories: Offsite Blogs

gist.github.com

del.icio.us/haskell - Thu, 12/11/2014 - 12:22pm
Categories: Offsite Blogs

2, 3, 4 Trees

Haskell on Reddit - Thu, 12/11/2014 - 4:44am

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]
Categories: Incoming News