
4 Jun
2009
4 Jun
'09
6:56 a.m.
Ahn, Ki Yung wrote:
Scary type inference for monadic function definitions (or, why you'd want to annotate types for monadic function definitions)
This is a real example that I've experienced.
I defined the following function.
checkOneVerseByLineWith readLine v = do mg <- readLine case mg of Just g -> return Just (v==g) Nothing -> return Nothing
How about liftM (fmap (v==)) readLine ? -- Mit freundlichen Gruessen Henning Thielemann Viele Gruesse Henning Martin-Luther-Universitaet Halle-Wittenberg, Institut fuer Informatik Tel. +49 - 345 - 55 24773 Fax +49 - 345 - 55 27333