Skip to content

Instantly share code, notes, and snippets.

@billdozr
Created June 27, 2010 19:37
Show Gist options
  • Save billdozr/455122 to your computer and use it in GitHub Desktop.
Save billdozr/455122 to your computer and use it in GitHub Desktop.
data TodoEntry = TodoEntry { milestone :: (Maybe String)
, action :: String
, users :: (Maybe [String])
, priority :: (Maybe Char)
, timeSpent :: (Maybe Double)
} deriving (Eq, Ord)
instance Show TodoEntry where
show entry = todoTagStr ++ (uStr $ users entry) ++ ": "
++ (mStr $ milestone entry)
++ (action entry)
++ (attStr (priority entry, timeSpent entry))
where mStr Nothing = ""
mStr (Just s) = s ++ " :: "
uStr Nothing = ""
uStr (Just ul) = "(" ++ (intercalate ", " ul) ++ ")"
attStr (Nothing, Nothing) = ""
attStr (Just p, Just t) = " :: " ++ [p] ++ ", " ++ (show t)
attStr (Just p, Nothing) = " :: " ++ [p]
attStr (Nothing, Just t) = " :: " ++ (show t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment