[Haskell-cafe] Arrows and 'do' syntax

Greg Fitzgerald garious at gmail.com
Tue Jul 11 19:58:17 EDT 2006


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell-cafe/attachments/20060711/5b14537a/attachment.htm


More information about the Haskell-Cafe mailing list