NeoHaskell icon indicating copy to clipboard operation
NeoHaskell copied to clipboard

Implement writeTextHandler function in File.hs

Open coderabbitai[bot] opened this issue 1 year ago • 0 comments
trafficstars

The writeTextHandler function in File.hs is currently not implemented. Please ensure that it is implemented correctly and follows best practices.

Suggested implementation:

writeTextHandler :: (Unknown.Convertible msg) => WriteTextOptions msg -> IO msg
writeTextHandler options = do
  result <- options.path |> Path.toLinkedList |> TIO.writeFile options.text |> Exception.try @Exception.IOError
  case result of
    Either.Left _ -> pure (options.onError NotWritable)
    Either.Right _ -> pure options.onSuccess

For more details, refer to the PR: https://github.com/neohaskell/NeoHaskell/pull/82 and the comment: https://github.com/neohaskell/NeoHaskell/pull/82#discussion_r1693458450

coderabbitai[bot] avatar Jul 26 '24 18:07 coderabbitai[bot]