News aggregator

Pet Haskell peeve: cabal's "Last 10 lines of the build log"

Haskell on Reddit - Fri, 11/14/2014 - 12:28am

Whose idea was this and why? Why would I ever not want to see the whole build log? It's enormously annoying as I can't use the command-line output as the list of errors to work on; I have to go and actually find the build log file.

Even "first 10 lines of the build log" would have been more useful.

submitted by AshleyYakeley
[link] [15 comments]
Categories: Incoming News

Mechanize in Haskell or Revive Shpider?

haskell-cafe - Fri, 11/14/2014 - 12:14am
What would be a good way to model mechanize in Haskell? For instance the python mechanize example is quite simple: def google_search(keyword): br = mechanize.Browser()"") br.select_form(name="gbqf") br["q"] = keyword response = br.submit() print html_to_text( I was thinking I could just use a StateT monad transformer with the current pages html as a cursor. Then have something like: get "" >>= (\c -> c $// form (Name "gbqf") >=> input (Name "q") &| submit . modifyVal "query" "Haskell") That's kinda horrible but it's a place to start. Or would I be better off trying to revive Shpider?
Categories: Offsite Discussion

Under what conditions are finalizers not run?

glasgow-user - Thu, 11/13/2014 - 9:02pm
Hi, the documentation of System.Mem.Weak under <> says the following: In which situations are finalizers not run? I see that they might not be run when the program ends while the weak pointer is still alive, but are there also other situations? The above quote seems to say that even an implementation that ignores any finalizers would conform to the API specification. I think it is actually quite bad if you do not have any guarantees about when finalizers are run. In the memo table example, for instance, this would mean that the memo table could grow very large, which would not just result in bad space complexity, but also bad time complexity for lookups. I am actually particularly interested in adding finalizers to IORefs. Are there any stronger guarantees for finalizers attached to IORefs and MVars? All the best, Wolfgang
Categories: Offsite Discussion

Monoid instance for IO

libraries list - Thu, 11/13/2014 - 5:13pm
I would like to add the following `Monoid` instance for `IO` to `Data.Monoid`: ``` instance Monoid a => Monoid (IO a) where mempty = pure mempty mappend = liftA2 mappend ``` I describe the benefit of this particular instance in this blog post: ... and Conal Elliot describes the general trick of recursively lifting `Monoid` instances in his type class morphisms paper: The primary benefit of the `Monoid` instance is that it chains well with other `Monoid` instances in `base` to create derived `Monoid` instances. The following types are examples of useful derived `Monoid` instances: ``` IO () -- Because `()` is a `Monoid` a -> IO () -- Because `a -> r` is a `Monoid` if `r` is a `Monoid` IO (a -> IO ()) -- This comment explains the utility of this instance:
Categories: Offsite Discussion

GHC 7.8.3 thread hang

glasgow-user - Tue, 11/11/2014 - 9:11am
I am trying to debug a lockup problem (and need help with debugging technique), where hang means a thread stops at a known place during evaluation, and other threads continue. The code near the problem is like: ec <- return $ encode command l <- return $ BSL.length ec ss <- return $ BSC.unpack ec It does not matter if I use let or return, or if the length is taken after unpack. I used return so I could use this code for tracing, with strictness to try to find the exact statement that is the problem: traceEventIO "sendCommand" ec <- return $ encode command traceEventIO $ "sendCommand: encoded" l <- ec `seq` return $ BSL.length ec traceEventIO $ "sendCommand: size " ++ (show l) ss <- ec `seq` return $ BSC.unpack ec When this runs, the program executes this many times, but always hangs under a certain condition. For good evaluations: 7f04173ff700: cap 0: sendCommand 7f04173ff700: cap 0: sendCommand: encoded 7f04173ff700: cap 0: sendCommand: s
Categories: Offsite Discussion

Annotations: status and documentation

glasgow-user - Wed, 11/05/2014 - 10:21pm
I would like to be able to retrieve user-supplied annotations in Template Haskell. The 7.8 user manual doesn't mention this ability. However, I see this Trac page: Where it appears that this feature may exist in 7.8. I will gladly tinker with annotations and update the user manual if someone will help me understand what the situation is. On a related note, it looks like this patch pointed to from the Wiki page for annotations got ignored. Should i submit it to phabricator? Thanks, Greg Weber _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users< at >
Categories: Offsite Discussion

New gtk2hs 0.12.4 release

gtk2hs - Wed, 11/21/2012 - 12:56pm

Thanks to John Lato and Duncan Coutts for the latest bugfix release! The latest packages should be buildable on GHC 7.6, and the cairo package should behave a bit nicer in ghci on Windows. Thanks to all!


Categories: Incoming News