Daniel Santa Cruz | 19 Sep 04:08 2013
Picon

Haskell Weekly News: Issue 280

Welcome to issue 280 of the HWN, an issue covering crowd-sourced bits
of information about Haskell from around the web. This issue covers the
week of September 8 to 14, 2013.

Quotes of the Week

   * haasn: edwardk uses things in anger. shachaf uses them with
     disappointment :(

   * shachaf: Are you reading Mac Lane now? Saizan: yeah, it's not so
     bad if you skip the examples

Top Reddit Stories

   * For my 17th birthday, my best friend got me "The most obscure programming book I could find" as a joke. I know what language I am learning next!
     Domain: i.imgur.com, Score: 163, Comments: 67
     On Reddit: [1] http://goo.gl/0SyN5l
     Original: [2] http://goo.gl/oqGBzL

   * pipes-4.0: Simpler types and API
     Domain: haskellforall.com, Score: 95, Comments: 36
     On Reddit: [3] http://goo.gl/ciVnq5
     Original: [4] http://goo.gl/g9oq3i

   * Hackage 2 now available for beta testing -- switchover in a few weeks
     Domain: beta.hackage.haskell.org, Score: 91, Comments: 17
     On Reddit: [5] http://goo.gl/aIhL67
     Original: [6] http://goo.gl/zfprr9

   * Cartesian Closed Comic #22: Cabal 1.18
     Domain: ro-che.info, Score: 90, Comments: 3
     On Reddit: [7] http://goo.gl/tVUUFG
     Original: [8] http://goo.gl/O0BR6c

   * Parallel and Incremental CRCs by Edward Kmett
     Domain: fpcomplete.com, Score: 58, Comments: 7
     On Reddit: [9] http://goo.gl/YAChJl
     Original: [10] http://goo.gl/WnMsbY

   * Conquering Folds by Edward Kmett
     Domain: fpcomplete.com, Score: 47, Comments: 42
     On Reddit: [11] http://goo.gl/reAjgu
     Original: [12] http://goo.gl/kHsSye

   * Conal Elliot: From Haskell to hardware via cartesian closed categories
     Domain: conal.net, Score: 47, Comments: 3
     On Reddit: [13] http://goo.gl/VCwp7Y
     Original: [14] http://goo.gl/NO1sbs

   * FP Complete to release a personal edition of their online IDE
     Domain: fpcomplete.com, Score: 39, Comments: 38
     On Reddit: [15] http://goo.gl/QOMy5Y
     Original: [16] http://goo.gl/XBE7zT

   * Quark : A Web Browser with a Formally Verified Kernel
     Domain: goto.ucsd.edu, Score: 36, Comments: 6
     On Reddit: [17] http://goo.gl/RDZMY0
     Original: [18] http://goo.gl/rgBcki

   * My first Haskell program - FNIStash - a utility for Torchlight 2 using threepenny for the GUI
     Domain: fluffynukeit.com, Score: 36, Comments: 19
     On Reddit: [19] http://goo.gl/cK2N8v
     Original: [20] http://goo.gl/XOMTgQ

   * Conal Elliott: Overloading lambda
     Domain: conal.net, Score: 34, Comments: 4
     On Reddit: [21] http://goo.gl/fQTt1P
     Original: [22] http://goo.gl/oPSQ3R

   * Cost semantics for STG in modern GHC
     Domain: blog.ezyang.com, Score: 31, Comments: 5
     On Reddit: [23] http://goo.gl/mIQQxm
     Original: [24] http://goo.gl/5Sa49T

   * 0install - Python vs. OCaml vs. Haskell
     Domain: roscidus.com, Score: 31, Comments: 23
     On Reddit: [25] http://goo.gl/htCf1x
     Original: [26] http://goo.gl/zhrVp0

   * LogicGrowsOnTrees: a parallel implementation of logic programming using distributed tree exploration
     Domain: github.com, Score: 31, Comments: 9
     On Reddit: [27] http://goo.gl/zp5lou
     Original: [28] http://goo.gl/5BgYh2

   * RSS reader made by Haskell running on mbed platform (RAM size 64kB, using Ajhc Haskell compiler).
     Domain: youtube.com, Score: 30, Comments: 5
     On Reddit: [29] http://goo.gl/n0Gkan
     Original: [30] http://goo.gl/cwL4vP

   * Conal Elliott: Optimizing CCCs
     Domain: conal.net, Score: 30, Comments: 12
     On Reddit: [31] http://goo.gl/HVv8dr
     Original: [32] http://goo.gl/MCn0sO

   * Snap (and Heist) 0.13 released
     Domain: snapframework.com, Score: 29, Comments: 7
     On Reddit: [33] http://goo.gl/zW5Sdn
     Original: [34] http://goo.gl/1wSLeJ

   * ANN: threepenny-gui-0.3 – GUI framework that uses the web browser as a display – now with FRP built-in
     Domain: apfelmus.nfshost.com, Score: 28, Comments: 8
     On Reddit: [35] http://goo.gl/RUDrKD
     Original: [36] http://goo.gl/WZMeZN

Top StackOverflow Questions

   * In Haskell, where does the range ['a'..] stop?
     votes: 20, answers: 2
     Read on SO: [37] http://goo.gl/Oms7lr

   * Why were Haskell 98's standard classes made inferior to Haskell 1.3's?
     votes: 18, answers: 1
     Read on SO: [38] http://goo.gl/WxvdL2

   * 27 different Bool to Bool values in Haskell
     votes: 14, answers: 1
     Read on SO: [39] http://goo.gl/1PcD1g

   * How to reconstruct Haskell expression from type
     votes: 10, answers: 1
     Read on SO: [40] http://goo.gl/Qx06kz

   * Can links to anchors in haddock be labeled?
     votes: 8, answers: 0
     Read on SO: [41] http://goo.gl/5deOMM

   * How to convert between ByteString and Storable Vector?
     votes: 7, answers: 1
     Read on SO: [42] http://goo.gl/zBVVzI

   * Why is not GHC optimizing for constants?
     votes: 7, answers: 2
     Read on SO: [43] http://goo.gl/sfo64S

   * newtype around ST causes type error
     votes: 7, answers: 1
     Read on SO: [44] http://goo.gl/CwXaJp

   * GHC does not generate a binary despite no errors shown
     votes: 6, answers: 1
     Read on SO: [45] http://goo.gl/PAv1oQ

Until next time,
[46]+Daniel Santa Cruz

References

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Vlatko Basic | 21 Sep 11:13 2013
Picon

Problem with HXT `when`

Hello Cafe,

I have this HTML structure:
...
<table>
     ...
     <tr>
         <th>Caption</th>
         <td>
             <a href="...">Want this</a>
             <a href="...">And this</a>
         </td>
      </tr>
      <tr>
          <th>Another caption</th>
             <td>
              ....
       <tr>
           <th>Yet another caption</th>
       ...
</table>
...

I'd like to extract A texts from row with header "Caption", and have come up 
with this

runX $ doc
     >>> (deep (hasName "tr")                                       -- filter 
only TRs
                >>> withTraceLevel 5 traceTree                   -- shows correct TR
                `when`
              deep (
                 hasName "th" >>>                                       -- 
filter THs with specified text
                 getChildren >>> hasText (=="Caption")
              ) -- inner deep
              >>> getChildren >>> hasName "td" -- shouldn't here be only one TR?
              >>> getChildren
           )
          >>> getName &&& (getChildren >>> getText)  -- list has TDs from all 
three TRs

Tried with `guards` but getting the same result.

I know there are other packages that might solve this in another way, but I'd 
like to understand what is going on here.

br,

vlatko
Albert Y. C. Lai | 25 Sep 03:22 2013
Picon

Re: Problem with HXT `when`

On 13-09-21 05:13 AM, Vlatko Basic wrote:
> I'd like to extract A texts from row with header "Caption", and have
> come up with this
>
> runX $ doc
>      >>> (deep (hasName "tr")                                       --
> filter only TRs
>                 >>> withTraceLevel 5 traceTree                   --
> shows correct TR
>                 `when`
>               deep (
>                  hasName "th" >>>
> -- filter THs with specified text
>                  getChildren >>> hasText (=="Caption")
>               ) -- inner deep
>               >>> getChildren >>> hasName "td" -- shouldn't here be only
> one TR?
>               >>> getChildren
>            )
>           >>> getName &&& (getChildren >>> getText)  -- list has TDs
> from all three TRs

Operator precedences:
   >>> infixr 1
   `when` infixl 9 (default)

Therefore, this expression redundantly parenthesized and systematically 
indented to ensure that you are on the same page with the computer is:

runX $
     doc
     >>>
     ( deep (hasName "tr")
       >>>
-- begin{conditionally prints but otherwise is arr id}
       ( withTraceLevel 5 traceTree
         `when`
         deep ( hasName "th"
                >>>
                getChildren
                >>>
                hasText (=="Caption")
              ) -- inner deep
       )
-- end{conditionally prints but otherwise is arr id}
       >>>
       getChildren
       >>>
       hasName "td"
       >>>
       getChildren
     )
     >>>
     ( getName &&& (getChildren >>> getText) )

The condition on <th>Caption</th> ends up controlling trace messages 
only; it is not used to limit real processing.

"when" doesn't help even when used correctly: it doesn't ban data. 
"guards" and "containing" ban data, but you have to put them at the 
right place, i.e., parenthesize correctly.

runX $
     doc
     >>>
     ( deep ( hasName "tr"
              `containing`
              deep ( hasName "th"
                     >>>
                     getChildren
                     >>>
                     hasText (=="Caption")
                   )
            )
       >>>
       getChildren
       >>>
       hasName "td"
       >>>
       getChildren
     )
     >>>
     ( getName
       &&&
       (getChildren >>> getText)
     )
Vlatko Basic | 25 Sep 15:36 2013
Picon

Re: Problem with HXT `when`

Hi Albert,

thanks for your answer. It helped in some other issues I have.
I did experiment with parenthesis, but obviously not in the right place.

I found the filterA arrow to do the thing I want, like this:

getRowWithHeading caption =
	filterA (deep (hasName "th" /> hasText (==caption) )) />
         hasName "td" >>>
         getChildren

I like to ask you if you might know the answer to the following:

In a structure
    +---XTag "a"
    |   +---XText "A text 1"
    |
    +---XText "Plain text 1"
    |
    +---XTag "a"
    |   +---XText "A text 2"
    |
    +---XText "Plain text 2"
    ...

I must combine "A text 1" with "Plain text 1", etc., but they are in sequence on 
the same level.

Is it possible, in a simple way, to do it in a single arrow flow?
(Or only outside the arrow by pairing the list items?)

Something like:
   hasName "a" /> getText  &&& (getNextItem??? >>> getText)

I assume not, but I'm still new to Haskell and would like to check.

br,

vlatko

-------- Original Message  --------
Subject: Re: [Haskell-cafe] Problem with HXT `when`
From: Albert Y. C. Lai <trebla <at> vex.net>
To: haskell-cafe <at> haskell.org
Date: 25.09.2013 03:22

> On 13-09-21 05:13 AM, Vlatko Basic wrote:
>> I'd like to extract A texts from row with header "Caption", and have
>> come up with this
>>
>> runX $ doc
>>      >>> (deep (hasName "tr")                                       --
>> filter only TRs
>>                 >>> withTraceLevel 5 traceTree                   --
>> shows correct TR
>>                 `when`
>>               deep (
>>                  hasName "th" >>>
>> -- filter THs with specified text
>>                  getChildren >>> hasText (=="Caption")
>>               ) -- inner deep
>>               >>> getChildren >>> hasName "td" -- shouldn't here be only
>> one TR?
>>               >>> getChildren
>>            )
>>           >>> getName &&& (getChildren >>> getText)  -- list has TDs
>> from all three TRs
>
> Operator precedences:
>    >>> infixr 1
>    `when` infixl 9 (default)
>
> Therefore, this expression redundantly parenthesized and systematically indented
> to ensure that you are on the same page with the computer is:
>
> runX $
>      doc
>      >>>
>      ( deep (hasName "tr")
>        >>>
> -- begin{conditionally prints but otherwise is arr id}
>        ( withTraceLevel 5 traceTree
>          `when`
>          deep ( hasName "th"
>                 >>>
>                 getChildren
>                 >>>
>                 hasText (=="Caption")
>               ) -- inner deep
>        )
> -- end{conditionally prints but otherwise is arr id}
>        >>>
>        getChildren
>        >>>
>        hasName "td"
>        >>>
>        getChildren
>      )
>      >>>
>      ( getName &&& (getChildren >>> getText) )
>
> The condition on <th>Caption</th> ends up controlling trace messages only; it is
> not used to limit real processing.
>
> "when" doesn't help even when used correctly: it doesn't ban data. "guards" and
> "containing" ban data, but you have to put them at the right place, i.e.,
> parenthesize correctly.
>
> runX $
>      doc
>      >>>
>      ( deep ( hasName "tr"
>               `containing`
>               deep ( hasName "th"
>                      >>>
>                      getChildren
>                      >>>
>                      hasText (=="Caption")
>                    )
>             )
>        >>>
>        getChildren
>        >>>
>        hasName "td"
>        >>>
>        getChildren
>      )
>      >>>
>      ( getName
>        &&&
>        (getChildren >>> getText)
>      )
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe <at> haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
Daniel Santa Cruz | 26 Sep 03:56 2013
Picon

Haskell Weekly News: Issue 281

Welcome to issue 281 of the HWN, an issue covering crowd-sourced bits
of information about Haskell from around the web. This issue covers the
week of September 15 to 21, 2013.

Quotes of the Week

   * jmcarthur: weak algebraic structures? ha! i prefer my algebraic
     structures to put up more of a fight.

   * newsham: teach a man to pred and he will pred to zero. teach a man
     to succ and he will succ forever

Top Reddit Stories

   * Edward C++Hands
     Domain: bartoszmilewski.com, Score: 83, Comments: 102
     On Reddit: [1] http://goo.gl/64LLo4
     Original: [2] http://goo.gl/0H0yr7

   * Perfect streaming using `pipes-bytestring`
     Domain: haskellforall.com, Score: 59, Comments: 45
     On Reddit: [3] http://goo.gl/oSlzZP
     Original: [4] http://goo.gl/8xwZjc

   * Adding safe coercions to Haskell
     Domain: joachim-breitner.de, Score: 58, Comments: 23
     On Reddit: [5] http://goo.gl/2vs5M9
     Original: [6] http://goo.gl/n0RYA3

   * Which programming languages do you like besides Haskell, and why?
     Domain: self.haskell, Score: 55, Comments: 104
     On Reddit: [7] http://goo.gl/nzgwJQ
     Original: [8] http://goo.gl/nzgwJQ

   * GHC HEAD: merged checkable "minimal complete definitions" (#7633)
     Domain: ghc.haskell.org, Score: 48, Comments: 36
     On Reddit: [9] http://goo.gl/VoZVYL
     Original: [10] http://goo.gl/5F61AX

   * Do companies ever hire someone who has no Haskell experience to be a 
     Haskell programmer? If I pursue such a job, how important would a 
     
     Domain: self.haskell, Score: 44, Comments: 50
     On Reddit: [11] http://goo.gl/KA998k
     Original: [12] http://goo.gl/KA998k

   * [Haskell-cafe] PSA: do not install xcode 5 if you are using ghc 7.6
     Domain: haskell.org, Score: 43, Comments: 4
     On Reddit: [13] http://goo.gl/ut6k6p
     Original: [14] http://goo.gl/1G8Syo

   * Model Analysis - The New York Times’ Erik Hinton breaks down a 
     Fashion Week special
     Domain: source.mozillaopennews.org, Score: 40, Comments: 4
     On Reddit: [15] http://goo.gl/NdVw6l
     Original: [16] http://goo.gl/bYB8JS

   * Programming reactively with both barrels 
     (experiences of Haskell/FRP for mobile games)
     Domain: blog.reactiveprogramming.org, Score: 39, Comments: 7
     On Reddit: [17] http://goo.gl/QXacUo
     Original: [18] http://goo.gl/wLJwt6

   * Why monads have not taken the Common Lisp world by storm [r/lisp]
     Domain: reddit.com, Score: 33, Comments: 14
     On Reddit: [19] http://goo.gl/tZUVWx
     Original: [20] http://goo.gl/w5KHqc

   * 13,000 readers
     Domain: self.haskell, Score: 28, Comments: 11
     On Reddit: [21] http://goo.gl/lTys0R
     Original: [22] http://goo.gl/lTys0R

   * A type for IO actions that do not throw exceptions
     Domain: self.haskell, Score: 25, Comments: 49
     On Reddit: [23] http://goo.gl/Ao8HyB
     Original: [24] http://goo.gl/Ao8HyB

   * ANN: Scotty 0.5.0 Released
     Domain: github.com, Score: 24, Comments: 15
     On Reddit: [25] http://goo.gl/jgGJhO
     Original: [26] http://goo.gl/BejPTF

   * Haskell version freezing
     Domain: blog.docmunch.com, Score: 23, Comments: 8
     On Reddit: [27] http://goo.gl/9LJSjY
     Original: [28] http://goo.gl/Ikd86k

   * PHOAS For Free by Edward Kmett
     Domain: fpcomplete.com, Score: 21, Comments: 8
     On Reddit: [29] http://goo.gl/RDt1BV
     Original: [30] http://goo.gl/o0phN7

   * Cellular Automata, Part III by Edward Kmett
     Domain: fpcomplete.com, Score: 20, Comments: 0
     On Reddit: [31] http://goo.gl/AKCfGw
     Original: [32] http://goo.gl/x7GtH1

   * Translating Haskell programs to Coq [/Gallina] programs
     Domain: github.com, Score: 20, Comments: 2
     On Reddit: [33] http://goo.gl/IQAp3K
     Original: [34] http://goo.gl/qcib77

   * ANN: pipes-csv: a fast, streaming csv parser based on cassava and pipes
     Domain: github.com, Score: 20, Comments: 9
     On Reddit: [35] http://goo.gl/aITtGX
     Original: [36] http://goo.gl/yrzZ7n

Top StackOverflow Questions

   * What does the “Just” syntax mean in Haskell?
     votes: 12, answers: 4
     Read on SO: [37] http://goo.gl/f17UEP

   * How can I understand “:t ((==) <*>)” in haskell?
     votes: 10, answers: 1
     Read on SO: [38] http://goo.gl/CwyBn4

   * why polymorphism is so costly in haskell(GHC)?
     votes: 10, answers: 3
     Read on SO: [39] http://goo.gl/4MjcbH

   * Break and continue in GHCi debugger without use of breakpoints
     votes: 9, answers: 0
     Read on SO: [40] http://goo.gl/HrtcXZ

   * Why is there no `-XDeriveApplicative` extension?
     votes: 8, answers: 1
     Read on SO: [41] http://goo.gl/4dcRF1

   * Downsides to ScopedTypeVariables
     votes: 7, answers: 2
     Read on SO: [42] http://goo.gl/UjBcsg

   * Haskell design encompassing several monads
     votes: 7, answers: 1
     Read on SO: [43] http://goo.gl/EwWd5d

   * How to correct my OOP tendencies when programming in Haksell
     votes: 7, answers: 3
     Read on SO: [44] http://goo.gl/9JVqh7

   * composing functions with higher arity
     votes: 7, answers: 5
     Read on SO: [45] http://goo.gl/jQjNJW

   * Why are Haskell Maps implemented as balanced binary trees instead of 
     traditional hashtables?
     votes: 7, answers: 3
     Read on SO: [46] http://goo.gl/nZaLGV

Until next time,
[47]+Daniel Santa Cruz

References


_______________________________________________
Haskell mailing list
Haskell <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell
Henk-Jan van Tuyl | 27 Sep 00:33 2013
Picon

Re: Haskell Weekly News: Issue 281

On Thu, 26 Sep 2013 03:56:28 +0200, Daniel Santa Cruz <dstcruz <at> gmail.com>  
wrote:
>
>    * 13,000 readers
>      Domain: self.haskell, Score: 28, Comments: 11
>      On Reddit: [21] http://goo.gl/lTys0R

StackOverflow: 12,584 questions tagged Haskell, 4.9 k followers
1224 users on the Haskell IRC

Does anybody know how many people are subscribed to the Haskell mailing  
lists?

Regards,
Henk-Jan van Tuyl

--

-- 
Folding <at> home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.
http://folding.stanford.edu/

http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--

Gmane