
On 7/12/06, Greg Fitzgerald
I'm trying to translate this HXT code to use the Arrow 'do' syntax: readWriteDoc :: String -> IOSLA (XIOState s) b Int readWriteDoc path = readDocument [(a_validate, "0")] path >>> writeDocument [(a_output_encoding, isoLatin1)] "-" >>> getErrStatus
This attempt fails to compile: readWriteDoc :: String -> IOSLA (XIOState s) b Int readWriteDoc = proc path -> do doc <- readDocument [(a_validate, "0")] -< path result <- writeDocument [(a_output_encoding, isoLatin1)] "-" -< doc getErrStatus -< result
Hi, Greg. Looks like readWriteDoc is not an arrow but a function from strings to arrows. So 'path' is just an argument, not arrow input. Maybe this should work: readWriteDoc :: String -> IOSLA (XIOState s) b Int readWriteDoc path = proc input -> do doc <- readDocument [(a_validate, "0")] path -< input result <- writeDocument [(a_output_encoding, isoLatin1)] "-" -< doc getErrStatus -< result -- Tolik