[Haskell-cafe] Troubles getting isA of ArrowIf from HXT 8.10 to work as expected

Corey O'Connor coreyoconnor at gmail.com
Fri Oct 17 15:06:10 EDT 2008


I'm attempting to use ifA to conditionalize generated XHTML.
                ifA (arr test_status >>> arr (/= "Running"))
                    (mkelem "a" [attr "href" (arr test_log_URL >>>
mkText)] [txt "log"])
                    (mkelem "a" [attr "href" (arr test_log_URL >>>
mkText)] [txt "no log"])

The arrow type at the point of the ifA is (I think)  "XmlArrow a => a
XmlTree TestRun" where TestRun is defined as:
data TestRun = TestRun
    {
        test_log_URL        :: String,
        test_status         :: String
    }

The issue I'm seeing is that regardless of the predicate arrow the
result is always the same: The XmlTree for the True branch is always
generated. In other words, I get the same behavior using this code:
                ifA (arr (const False))
                    (mkelem "a" [attr "href" (arr test_log_URL >>>
mkText)] [txt "log"])
                    (mkelem "a" [attr "href" (arr test_log_URL >>>
mkText)] [txt "no log"])

Which, I thought, the "arr (const False)" would force the ifA to
always descend the False path.

This is my first attempt at using HXT and Arrows (Which is otherwise
going great!) so I figure I'm missing something. Any ideas?

Cheers,
Corey O'Connor


More information about the Haskell-Cafe mailing list