Alexander Solla schrieb:

>     buildMap :: GeneratorState1 (Map Prefix [String])
>     buildMap = do (mp,(pfx1,pfx2),words) <- get
>                   if (Prelude.null words)
>                     then {- No more words. Return final map (adding
>     non_word for final prefix). -}
>                       return (insertWithKey' f (pfx1,pfx2) [non_word] mp)
>                     else do {- Add word to map at prefix & continue. -}
>                       put (insertWithKey' f (pfx1,pfx2) [head words] mp,
>     (pfx2,(head words)), tail words)
>                       buildMap
> 
>>>> I'm not a fan of explicit if-then-else's, but my preferred

case words of
   [] -> {- no more words -} ...
   w:ws -> ...

would work perfectly.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to