Re: [Haskell-cafe] Re: [newbie] How to test this function?
On Thu, 21 Sep 2006, Bruno MartÃnez wrote: > > getList :: IO [Char] > > getList = take5 `fmap` getContents -- a thin IO "skin" > > > > take5 :: [Char] -> [Char] > > take5 = take 5 . filter (`elem` ['a'..'e']) -- the actual worker > > The problem is that getContents 'eats' stdin, which can't be used again. You can process the result of getContents as many times as you want. > I'm forced to change all my IO code to the getContents way, which is not > possible. If your program contains so much IO code you should seriously consider refactoring. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [newbie] How to test this function?
On 21/09/06, Benjamin Franksen <[EMAIL PROTECTED]> wrote: Emacs is evil! I'll ignore the throwaway flaimbait there ;) It also inserts random tab characters into your code just to save a few space bytes. Tends to completely trash indentation e.g. when pasting code into mails etc. Not once happened to me when writing Haskell code. It does annoy you when writing Lisp, but it takes a single line of config to turn it off. -- -David House, [EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [newbie] How to test this function?
If there's a problem with haskell emacs mode, it seems very likely that if you ask the maintainer nicely, he'll do something about it. See http://www.iro.umontreal.ca/~monnier/elisp/#haskell-mode I asked Stefan a while ago: I like your Emacs mode but it behaves a bit oddly when trying to indent if/then/else expressions in do notation. Typing tab only gives me one possible indentation, like so: do if True then foo else bar That is, the then and else branches line up under the if which is an error according to Haskell's layout rule. It probably should indent them like "case" with the then lining up with the condition to the if. I'd fix it myself if I knew Lisp but I don't. :/ Yes, it's a (recently) known problem which I haven't fixed yet. It's in the indent.hs test-suite, with a "FIXME" :-( ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe