[Haskell-cafe] N-ANN: HBlog-0.1

Tom Murphy amindfv at gmail.com
Mon Apr 1 15:16:24 CEST 2013

Hi All,
     Not particularly happy to announce the non-release of my latest
library, HBlog 0.1. I've been working on it steadily for a long time now,
but it's still not ready.

     The library -- when it's finished -- will be a 100% Haskell
representation of blogs, from authors and posts up to the most abstract
notion of an entire blog as a Haskell data type.

     I'd like to finish the library sometime, but I've been so busy! Any
spare time I've had, I've just ended up watching TV. I've been so caught up
with the final season of The Office, I didn't realize how much time had
passed since I originally had the idea! (2 years.) Didn't it seem like Jim
and Pam were going to break up a couple
weeks ago?!

     Anyway, here's the code I've definitely settled on so far:

data Author = Author { name :: String }
   deriving (Show, Eq)

data Post = Post { title   :: String
                 , body    :: String
                 , authors :: [Author] }
   deriving (Show)

data Blog = Blog [Post]

hasSingleAuthor :: Post -> Bool
hasSingleAuthor post = 1 == (length $ authors post)

     Feel free to use portions of this code in your own projects! Just be
sure to put at the top of all your source files: "Portions of this code (c)
2013 Tom Murphy. All rights reserved."

 -- Lenses sound pretty cool, so I've started writing lenses for the Author
type, as well as finding out what a lens is. Maybe one day there'll be
lenses for the Post type, too -- keep your fingers crossed!
 -- One time when I was walking home from work, I had the idea for blogs
being modeled as monads. Wouldn't that be awesome?: "The Blog Monad." I
haven't done it yet, though, because I haven't figured out what bind would
do. If you figure out how to model blogs as monads, just be sure to include
this in all of your sourcefiles: "Idea for blog monad (c) 2013 Tom Murphy.
All rights reserved."

Happy hacking!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130401/71eae0a3/attachment.htm>

More information about the Haskell-Cafe mailing list