Skip to content

decodeXls as a pure function, decodeXls :: ByteString -> [[[String]]] ? #6

@erikryb

Description

@erikryb

Is there any fundamental reason that the decodeXls functions need to use IO to parse an xls file? In my use case I would like to decouple the parsing logic from the IO code that reads the file. My workaround is using unsafePerformIO in the following way:

decodeXlsPure :: ByteString -> [[[String]]]
decodeXlsPure content =
  unsafePerformIO
    . withSystemTempFile "decodeXlsPure"
    $ \filePath handler -> do
      ByteString.hPut handler content
      decodeXlsIO filePath

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions