
Yes, Haskell is a rather big language and unfortunately has much redundancy. It seems mostly to be a matter of taste which of `let' and `where' you prefer. Personally, I nearly always use `where' when possible (for the same reason you give); `let' only if the `where' would be too far away. However, for your example I would use `case': main = putStrLn . show $ case maybe_read word of Nothing -> DP_Unkown Just index -> DP_Number index (Another matter of tast: I don't like `_' in identifiers, but use capital letters like the Haskell Prelude)
I was disappointed to find that I don't seem to be able to write things like,
main = let maybe_index = maybe_read word in putStr (show (if maybe_index == Nothing then DP_Unknown else DP_Number index) ++ "\n") where (Just index) = maybe_index
No, the `let' is in the scope of the `where', but the `where' is not in the scope of the `let'. Expressions are nested and allowing mutual recursion here would make things really confusing. Ciao, Olaf -- OLAF CHITIL, Dept. of Computer Science, University of York, York YO10 5DD, UK. URL: http://www.cs.york.ac.uk/~olaf/ Tel: +44 1904 434756; Fax: +44 1904 432767