
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 I get this error message: Couldn't match `(->)' against `IOSLA (XIOState s)' Expected type: t -> t1 Inferred type: IOStateArrow s XmlTree XmlTree Probable cause: `writeDocument' is applied to too many arguments in the call (writeDocument [(a_output_encoding, isoLatin1)] "-") In the command: writeDocument [(a_output_encoding, isoLatin1)] "-" -< doc Any idea what I'm doing wrong? Thanks, Greg

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
participants (2)
-
Anatoly Zaretsky
-
Greg Fitzgerald